function onBeforeDelete() { parent::onBeforeDelete(); if ($this->config()->get('deletePicturesOnDeleteGallery')) { foreach ($this->Pictures() as $pic) { $pic->delete(); } } }
public function onBeforeDelete() { if ($this->ItemsAsChildren) { $CurrentVal = $this->get_enforce_strict_hierarchy(); $this->set_enforce_strict_hierarchy(false); parent::onBeforeDelete(); $this->set_enforce_strict_hierarchy($CurrentVal); } else { parent::onBeforeDelete(); } }
function onBeforeDelete() { // check if Page still exists in live mode $className = $this->ClassName; $livePage = Versioned::get_one_by_stage($className, "Live", "\"{$className}_Live\".\"ID\" = {$this->ID}"); // check if Page still exists in stage mode $stagePage = Versioned::get_one_by_stage($className, "Stage", "\"{$className}\".\"ID\" = {$this->ID}"); // if Page only exists in Live OR Stage mode -> Page will be deleted completely if (!($livePage && $stagePage)) { // delete existing Albums $this->Albums()->removeAll(); } parent::onBeforeDelete(); }
/** * Set LastEdited field to now for the SilvercartProductGroupHolder. * * @return void * * @author Sascha Koehler <*****@*****.**> * @since 03.07.2012 */ public function onBeforeDelete() { $productGroupHolderPage = $this->getSilvercartProductGroupHolderPage(); if ($productGroupHolderPage) { $now = new DateTime(); $productGroupHolderPage->LastEdited = $now->format('Y-m-d H:i:s'); $productGroupHolderPage->write(); } parent::onBeforeDelete(); }
/** * Perform database cleanup when deleting */ public function onBeforeDelete() { parent::onBeforeDelete(); foreach ($this->Discussions() as $item) { $item->delete(); } foreach ($this->Categories() as $item) { $item->delete(); } }
public function onBeforeDelete() { if ($this->Status != "Published") { if ($this->ProductOptions()) { $options = $this->getComponents('ProductOptions'); foreach ($options as $option) { $option->delete(); } } if ($this->ProductImages()) { //delete product image dataobjects, not the images themselves. $images = $this->getComponents('ProductImages'); foreach ($images as $image) { $image->delete(); } } } parent::onBeforeDelete(); }