private function prepareSetAttributes()
    {
        $fragment = new CNabuPHPMethodBuilder($this, 'setAttributes', CNabuPHPMethodBuilder::METHOD_PROTECTED);
        $fragment->addComment("Set default attributes of $this->entity_name in XML Element.");
        $fragment->addParam(
            'element', 'SimpleXMLElement', false, null, 'SimpleXMLElement',
            'XML Element to set attributes'
        );

        if ($this->is_hashed) {
            $fragment->addFragment(
                "\$element->addAttribute('GUID', \$this->nb_data_object->grantHash(true));"
            );
        }

        if (is_array($this->element_attributes) && count($this->element_attributes) > 0) {
            $fragment->addFragment('$this->putAttributesFromList($element, array(');
            $count = count($this->element_attributes);
            foreach ($this->element_attributes as $field => $attr) {
                $fragment->addFragment("    '$field' => '$attr'" . (--$count > 0 ? ',' : ''));
            }
            $fragment->addFragment('), false);');
        }

        $this->getDocument()->addUse('\SimpleXMLElement');

        $this->addFragment($fragment);
    }
private function prepareSetAttributes()
    {
        $fragment = new CNabuPHPMethodBuilder($this, 'setAttributes', CNabuPHPMethodBuilder::METHOD_PROTECTED);
        $fragment->addComment("Set default attributes of $this->entity_name in XML Element.");
        $fragment->addParam(
            'element', 'SimpleXMLElement', false, null, 'SimpleXMLElement',
            'XML Element to set attributes'
        );

        if ($this->is_hashed) {
            $fragment->addFragment(
                "\$element->addAttribute('GUID', \$this->nb_data_object->grantHash(true));"
            );
        }

        if (is_array($this->element_attributes) && count($this->element_attributes) > 0) {
            $fragment->addFragment('$this->putAttributesFromList($element, array(');
            $count = count($this->element_attributes);
            foreach ($this->element_attributes as $field => $attr) {
                $fragment->addFragment("    '$field' => '$attr'" . (--$count > 0 ? ',' : ''));
            }
            $fragment->addFragment('), false);');
        }

        $this->getDocument()->addUse('\SimpleXMLElement');

        $this->addFragment($fragment);
    }
private function prepareSetAttributes ( ) { $ fragment = new CNabuPHPMethodBuilder ( $ this , 'setAttributes' , CNabuPHPMethodBuilder :: METHOD_PROTECTED ) ; $ fragment -> addComment ( "Set default attributes of $this->entity_name in XML Element." ) ; $ fragment -> addParam ( 'element' , 'SimpleXMLElement' , false , null , 'SimpleXMLElement' , 'XML Element to set attributes' ) ; if ( $ this -> is_hashed ) { $ fragment -> addFragment ( "\$element->addAttribute('GUID', \$this->nb_data_object->grantHash(true));" ) ; } if ( is_array ( $ this -> element_attributes ) && count ( $ this -> element_attributes ) > 0 ) { $ fragment -> addFragment ( '$this->putAttributesFromList($element, array(' ) ; $ count = count ( $ this -> element_attributes ) ; foreach ( $ this -> element_attributes as $ field => $ attr ) { $ fragment -> addFragment ( "    '$field' => '$attr'" . ( -- $ count > 0 ? ',' : '' ) ) ; } $ fragment -> addFragment ( '), false);' ) ; } $ this -> getDocument ( ) -> addUse ( '\SimpleXMLElement' ) ; $ this -> addFragment ( $ fragment ) ; }
Prepares the setAttributes method in case that is not a translation data entity.
Prepares the setAttributes method in case that is not a translation data entity .