Merge pull request #770 from nicolas-lescop/patch-2

Delete all selected related elements and not just the first element
This commit is contained in:
Samuel Georges 2014-11-15 15:12:25 +11:00
commit 0c5c03c14c

View File

@ -505,8 +505,9 @@ class RelationController extends ControllerBehavior
$this->beforeAjax(); $this->beforeAjax();
if (($checkedIds = post('checked')) && is_array($checkedIds)) { if (($checkedIds = post('checked')) && is_array($checkedIds)) {
foreach ($checkedIds as $relationId) { $relatedModel = $this->relationObject->getRelated();
if (!$obj = $this->relationObject->find($relationId)) { foreach ($checkedIds as $relationId) {
if (!$obj = $relatedModel->find($relationId)) {
continue; continue;
} }