Пример #1
0
 /**
  * @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);
 }
Пример #2
0
 /**
  * @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);
 }