delete all sub categories on category removal, fix issue #150

This commit is contained in:
Manuel Raynaud
2014-01-02 10:30:24 +01:00
parent 6057c69f95
commit b992cc8488

View File

@@ -121,6 +121,15 @@ class Category extends BaseCategory
{
$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));
}
}