Commit 0f985f01fbee392d93537fea7e579576dc1450df
1 parent
d5fbb6c3
20.07.16
Showing
1 changed file
with
6 additions
and
1 deletions
Show diff stats
common/modules/product/models/Category.php
| ... | ... | @@ -215,7 +215,12 @@ class Category extends \yii\db\ActiveRecord |
| 215 | 215 | |
| 216 | 216 | public function beforeDelete() |
| 217 | 217 | { |
| 218 | - print_r($this->products->deleteAll()); | |
| 218 | + | |
| 219 | + if(!empty($this->products)){ | |
| 220 | + foreach($this->products as $product){ | |
| 221 | + $product->delete(); | |
| 222 | + } | |
| 223 | + } | |
| 219 | 224 | die(); |
| 220 | 225 | } |
| 221 | 226 | ... | ... |