示例#1
0
 public function prepareObjectAttributes($record)
 {
     $property = array();
     foreach ($record->metas as $meta) {
         //
         // NEED TO REFACTORED
         //
         $prop_attr['key_name'] = $meta->meta->key_name;
         $prop_attr['value'] = $meta->meta_value;
         $prop_attr['descr'] = $meta->meta->descr;
         $prop_attr['id'] = $meta->id;
         //
         // ====
         $prop = new Property();
         $prop->setAttributes($prop_attr);
         $property[] = $prop->getAttributes();
     }
     $objects = array();
     foreach ($record->objects as $object) {
         $objects[] = array('name' => $object->name, 'text_value' => $object->text_value, 'descr' => $object->descr, 'id' => $object->id);
     }
     $attr = $record->getAttributes();
     $attr['type'] = $record->type->name;
     $attr['property'] = $property;
     $attr['objects'] = $objects;
     return $attr;
 }
示例#2
0
 public function setAttributes($attr)
 {
     parent::setAttributes($attr);
     $props = $attr['property'];
     if (isset($props) && is_array($props)) {
         foreach ($props as $propertyAttr) {
             $property = new Property();
             $property->setAttributes($propertyAttr);
             $this->property[] = $property;
         }
     }
 }
示例#3
0
 public function setAttributes($attr)
 {
     parent::setAttributes($attr);
     if (isset($attr['property']) && is_array($attr['property'])) {
         $props = $attr['property'];
         foreach ($props as $propertyAttr) {
             $property = new Property();
             $property->setAttributes($propertyAttr);
             $this->property[] = $property;
         }
     }
     if (isset($attr['objects']) && is_array($attr['objects'])) {
         $objects = $attr['objects'];
         foreach ($objects as $objectAttr) {
             $obj = new Object();
             $obj->setAttributes($objectAttr);
             $this->objects[] = $obj;
         }
     }
 }
 public function createDataObject($object)
 {
     $property = new Property();
     $property->setAttributes($object);
     return $property;
 }