/** * Deletes the document * * @return void */ public function delete() { \Pimcore::getEventManager()->trigger("document.preDelete", $this); // remove childs if ($this->hasChilds()) { // delete also unpublished children $unpublishedStatus = self::doHideUnpublished(); self::setHideUnpublished(false); foreach ($this->getChilds(true) as $child) { $child->delete(); } self::setHideUnpublished($unpublishedStatus); } // remove all properties $this->getDao()->deleteAllProperties(); // remove permissions $this->getDao()->deleteAllPermissions(); // remove dependencies $d = $this->getDependencies(); $d->cleanAllForElement($this); // remove translations $service = new Document\Service(); $service->removeTranslation($this); $this->getDao()->delete(); // clear cache $this->clearDependentCache(); //set object to registry \Zend_Registry::set("document_" . $this->getId(), null); \Pimcore::getEventManager()->trigger("document.postDelete", $this); }