Skip to content
This repository has been archived by the owner on Apr 22, 2022. It is now read-only.

Commit

Permalink
Persisting and removing Traverable collections
Browse files Browse the repository at this point in the history
  • Loading branch information
MrHash committed Apr 9, 2014
1 parent 17344d1 commit f10167b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/Doctrine/Search/SearchManager.php
Expand Up @@ -205,7 +205,9 @@ public function find($entityName, $id)
*/
public function persist($objects)
{
if(!is_array($objects)) $objects = array($objects);
if(!is_array($objects) && !$objects instanceof \Traversable) {
$objects = array($objects);
}
foreach($objects as $object) {
if (!is_object($object)) {
throw new UnexpectedTypeException($object, 'object');
Expand All @@ -223,7 +225,9 @@ public function persist($objects)
*/
public function remove($objects)
{
if(!is_array($objects)) $objects = array($objects);
if(!is_array($objects) && !$objects instanceof \Traversable) {
$objects = array($objects);
}
foreach($objects as $object) {
if (!is_object($object)) {
throw new UnexpectedTypeException($object, 'object');
Expand Down

0 comments on commit f10167b

Please sign in to comment.