/** * Get the data */ private function getData() { $this->id = $this->getParameter('id', 'int'); if ($this->id == null || !BackendCatalogModel::existsBrand($this->id)) { $this->redirect(BackendModel::createURLForAction('brands') . '&error=non-existing'); } $this->record = BackendCatalogModel::getBrand($this->id); }
/** * Execute the action */ public function execute() { $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id == null || !BackendCatalogModel::existsBrand($this->id)) { $this->redirect(BackendModel::createURLForAction('brands') . '&error=non-existing'); } // fetch the brand $this->record = (array) BackendCatalogModel::getBrand($this->id); // delete item BackendCatalogModel::deleteBrand($this->id); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete_brand', array('item' => $this->record)); // brand was deleted, so redirect $this->redirect(BackendModel::createURLForAction('brands') . '&report=deleted-brand&var=' . urlencode($this->record['title'])); }