public function map($object) { parent::map($object); $keys = get_object_vars($this); if (array_key_exists("childs", $keys)) { if ($object->hasChilds()) { $this->childs = array(); foreach ($object->getChilds() as $child) { $item = new Webservice_Data_Document_List_Item(); $item->id = $child->getId(); $item->type = $child->getType(); $this->childs[] = $item; } } } }
/** * @param Webservice_Data $wsDocument * @param Element_Interface $element * @return int */ protected function create($wsDocument, $element) { $wsDocument->reverseMap($element); $element->setId(null); $element->setCreationDate(time()); $this->setModificationParams($element, true); $key = $element->getKey(); if (empty($key)) { throw new Exception("Cannot create element without key"); } $element->save(); return $element->getId(); }