/** * Saves the document * * @return void */ public function save() { if (!Pimcore_Tool::isValidKey($this->getKey())) { throw new Exception("invalid key for object with id [ " . $this->getId() . " ]"); } $this->correctPath(); // set date $this->setModificationDate(time()); if ($this->getId()) { $this->update(); } else { Pimcore_API_Plugin_Broker::getInstance()->preAddDocument($this); $this->getResource()->create(); Pimcore_API_Plugin_Broker::getInstance()->postAddDocument($this); $this->update(); } }
/** * @return void */ public function save() { if (!Pimcore_Tool::isValidKey($this->getKey())) { throw new Exception("invalid filname '" . $this->getKey() . "' for asset with id [ " . $this->getId() . " ]"); } $this->correctPath(); if ($this->getId()) { $this->update(); } else { $this->getResource()->create(); Pimcore_API_Plugin_Broker::getInstance()->postAddAsset($this); $this->update(); } }
/** * @return void */ public function save() { // be sure that unpublished objects in relations are saved also in frontend mode, eg. in importers, ... $hideUnpublishedBackup = self::getHideUnpublished(); self::setHideUnpublished(false); if (!Pimcore_Tool::isValidKey($this->getKey())) { throw new Exception("invalid key for object with id [ " . $this->getId() . " ]"); } $this->correctPath(); if ($this->getO_Id()) { $this->update(); } else { Pimcore_API_Plugin_Broker::getInstance()->preAddObject($this); $this->getResource()->create(); Pimcore_API_Plugin_Broker::getInstance()->postAddObject($this); $this->update(); } self::setHideUnpublished($hideUnpublishedBackup); }