Skip to content

Commit

Permalink
Optimized reloading for batchDelete - do not reload first object sinc…
Browse files Browse the repository at this point in the history
…e there were no changes yet
  • Loading branch information
rozwell committed Feb 29, 2012
1 parent a5ec235 commit 302a06d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion data/generator/sfPropelModule/admin/parts/batchAction.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected function executeBatchDelete(sfWebRequest $request)
$this->dispatcher->notify(new sfEvent($this, 'admin.delete_object', array('object' => $object))); $this->dispatcher->notify(new sfEvent($this, 'admin.delete_object', array('object' => $object)));


// reload the object if it's in a tree to avoid breaking nested set structure // reload the object if it's in a tree to avoid breaking nested set structure
if (method_exists($object, 'isInTree') && $object->isInTree()) if ($count && method_exists($object, 'isInTree') && $object->isInTree())
{ {
$object->reload(); $object->reload();
} }
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected function executeBatchDelete(sfWebRequest $request)
$this->dispatcher->notify(new sfEvent($this, 'admin.delete_object', array('object' => $object))); $this->dispatcher->notify(new sfEvent($this, 'admin.delete_object', array('object' => $object)));


// reload the object if it's in a tree to avoid breaking nested set structure // reload the object if it's in a tree to avoid breaking nested set structure
if (method_exists($object, 'isInTree') && $object->isInTree()) if ($count && method_exists($object, 'isInTree') && $object->isInTree())
{ {
$object->reload(); $object->reload();
} }
Expand Down

0 comments on commit 302a06d

Please sign in to comment.