/** * @param $id * @return bool|mixed|void */ public function delete($id) { $entity = $this->provider->findById($id); if (!$entity) { return false; } $products = $entity->getProducts(); if ($products->count()) { foreach ($products as $product) { $entity->removeProduct($product); } } return parent::delete($id); }
/** * @param $id * @return bool|mixed|void */ public function delete($id) { $entity = $this->provider->findById($id); if (!$entity) { return false; } $categories = $entity->getCategories(); if ($categories->count()) { foreach ($categories as $category) { $entity->removeCategory($category); } } return parent::delete($id); }