Пример #1
0
 public function reverseMap($object)
 {
     parent::reverseMap($object);
     $object->childs = null;
     $object->elements = array();
     if (is_array($this->elements)) {
         foreach ($this->elements as $element) {
             $tag = Document_Tag::factory($element->type, $element->name, $this->id);
             $tag->getFromWebserviceImport($element);
             $object->elements[$element->name] = $tag;
         }
     }
 }
Пример #2
0
 /**
  * @param Webservice_Data_Document $wsDocument
  * @return bool
  */
 protected function updateDocument($wsDocument)
 {
     $document = Document::getById($wsDocument->id);
     $this->setModificationParams($document, false);
     if ($document instanceof Document and strtolower($wsDocument->type) == $document->getType()) {
         $wsDocument->reverseMap($document);
         $document->save();
         return true;
     } else {
         if ($document instanceof Document) {
             throw new Exception("Type mismatch for given document with ID [" . $wsDocument->id . "] and existing document with id [" . $document->getId() . "]");
         } else {
             throw new Exception("Document with given ID (" . $wsDocument->id . ") does not exist.");
         }
     }
 }