Beispiel #1
0
 public function reverseMap($object)
 {
     $data = base64_decode($this->data);
     unset($this->data);
     parent::reverseMap($object);
     $object->setData($data);
 }
Beispiel #2
0
 /**
  * @param Webservice_Data_Asset $wsDocument
  * @return bool
  */
 protected function updateAsset($wsDocument)
 {
     $asset = Asset::getById($wsDocument->id);
     $this->setModificationParams($asset, false);
     if ($asset instanceof Asset and $asset->getType() == strtolower($wsDocument->type)) {
         $wsDocument->reverseMap($asset);
         $asset->save();
         return true;
     } else {
         if ($asset instanceof Asset) {
             throw new Exception("Type mismatch for given asset with ID [" . $wsDocument->id . "] and existing asset with id [" . $asset->getId() . "]");
         } else {
             throw new Exception("Asset with given ID (" . $wsDocument->id . ") does not exist.");
         }
     }
 }