/** * Getter * Returns given attribute for current content object if it exists (ie. main_node_id). * Will throw an exception otherwise. * All "classic" attributes can be used (See {@link eZContentObject::definition()}). * @param $name * @throws ezcBasePropertyNotFoundException */ public function __get($name) { $ret = null; switch ($name) { case 'locations': if (!$this->currentLocations instanceof SQLILocationSet) { $this->refreshLocations(); } $ret = $this->currentLocations; break; case 'defaultLocation': if (!$this->currentLocations instanceof SQLILocationSet) { $this->refreshLocations(); } $ret = $this->currentLocations[$this->contentObject->mainNodeID()]; break; default: if ($this->contentObject->hasAttribute($name)) { $ret = $this->contentObject->attribute($name); } else { throw new ezcBasePropertyNotFoundException($name); } } return $ret; }
private function updateContentObject(eZContentObject $eZContentObject) { $mainNodeID = $eZContentObject->mainNodeID(); $parentNodeID = eZContentObjectTreeNode::getParentNodeId($mainNodeID); $classIdentifier = $eZContentObject->ClassIdentifier; $remoteID = $eZContentObject->RemoteID; if (!eZContentClass::fetchByIdentifier($classIdentifier)) { throw new Exception("La classe" . $classIdentifier . "non esiste in questa installazione"); } $params = array(); $params['class_identifier'] = $classIdentifier; $params['remote_id'] = $remoteID; $params['parent_node_id'] = $parentNodeID; $params['attributes'] = $this->getAttributesStringArray($eZContentObject); $result = eZContentFunctions::updateAndPublishObject($eZContentObject, $params); return $result; }