reorder position on folder and category tables before delete action
This commit is contained in:
@@ -106,7 +106,7 @@ class Category extends BaseCategory
|
||||
public function preDelete(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_DELETECATEGORY, new CategoryEvent($this));
|
||||
|
||||
$this->reorderBeforeDelete();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ class Folder extends BaseFolder
|
||||
public function preDelete(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_DELETEFOLDER, new FolderEvent($this));
|
||||
|
||||
$this->reorderBeforeDelete();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -198,4 +198,11 @@ trait PositionManagementTrait {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function reorderBeforeDelete()
|
||||
{
|
||||
$this->createQuery()
|
||||
->filterByParent($this->getParent())
|
||||
->update(array('Position' => '(position-1)'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user