delete all sub categories on category removal, fix issue #150
This commit is contained in:
@@ -121,6 +121,15 @@ class Category extends BaseCategory
|
|||||||
{
|
{
|
||||||
$this->markRewritenUrlObsolete();
|
$this->markRewritenUrlObsolete();
|
||||||
|
|
||||||
|
//delete all subcategories
|
||||||
|
$subCategories = CategoryQuery::findAllChild($this->getId());
|
||||||
|
|
||||||
|
foreach($subCategories as $category) {
|
||||||
|
$category->setDispatcher($this->getDispatcher());
|
||||||
|
|
||||||
|
$category->delete();
|
||||||
|
}
|
||||||
|
|
||||||
$this->dispatchEvent(TheliaEvents::AFTER_DELETECATEGORY, new CategoryEvent($this));
|
$this->dispatchEvent(TheliaEvents::AFTER_DELETECATEGORY, new CategoryEvent($this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user