| @@ 153-170 (lines=18) @@ | ||
| 150 | /** |
|
| 151 | * @inheritdoc |
|
| 152 | */ |
|
| 153 | public function beforeDelete() |
|
| 154 | { |
|
| 155 | if (!parent::beforeDelete()) { |
|
| 156 | return false; |
|
| 157 | } |
|
| 158 | ||
| 159 | $parts = ThemeWidgetApplying::find()->where(['widget_id'=>$this->id])->all(); |
|
| 160 | foreach ($parts as $part) { |
|
| 161 | $part->delete(); |
|
| 162 | } |
|
| 163 | ||
| 164 | $activeWidgets = ThemeActiveWidgets::find()->where(['widget_id'=>$this->id])->all(); |
|
| 165 | foreach ($activeWidgets as $widget) { |
|
| 166 | $widget->delete(); |
|
| 167 | } |
|
| 168 | ||
| 169 | return true; |
|
| 170 | } |
|
| 171 | } |
|
| 172 | ||
| @@ 294-311 (lines=18) @@ | ||
| 291 | /** |
|
| 292 | * @inheritdoc |
|
| 293 | */ |
|
| 294 | public function beforeDelete() |
|
| 295 | { |
|
| 296 | if (!parent::beforeDelete()) { |
|
| 297 | return false; |
|
| 298 | } |
|
| 299 | ||
| 300 | $activeParts = ThemeWidgetApplying::find()->where(['part_id'=>$this->id])->all(); |
|
| 301 | foreach ($activeParts as $part) { |
|
| 302 | $part->delete(); |
|
| 303 | } |
|
| 304 | ||
| 305 | $activeWidgets = ThemeActiveWidgets::find()->where(['widget_id'=>$this->id])->all(); |
|
| 306 | foreach ($activeWidgets as $widget) { |
|
| 307 | $widget->delete(); |
|
| 308 | } |
|
| 309 | ||
| 310 | return true; |
|
| 311 | } |
|
| 312 | } |
|
| 313 | ||