fix reorder position on folder and category removal
This commit is contained in:
@@ -201,8 +201,17 @@ trait PositionManagementTrait {
|
|||||||
|
|
||||||
protected function reorderBeforeDelete()
|
protected function reorderBeforeDelete()
|
||||||
{
|
{
|
||||||
$this->createQuery()
|
// Find DATABASE_NAME constant
|
||||||
->filterByParent($this->getParent())
|
$mapClassName = self::TABLE_MAP;
|
||||||
->update(array('Position' => '(position-1)'));
|
|
||||||
|
$sql = sprintf("UPDATE `%s` SET position=(position-1) WHERE parent=:parent AND position>:position", $mapClassName::TABLE_NAME);
|
||||||
|
|
||||||
|
$con = Propel::getConnection($mapClassName::DATABASE_NAME);
|
||||||
|
$statement = $con->prepare($sql);
|
||||||
|
|
||||||
|
$statement->execute(array(
|
||||||
|
':parent' => $this->getParent(),
|
||||||
|
':position' => $this->getPosition()
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user