persist() public method

Persists an entity as part of the current unit of work.
public persist ( object $entity )
$entity object The entity to persist.
コード例 #1
0
ファイル: SearchManager.php プロジェクト: revinate/search
 /**
  * Adds the object to the index
  *
  * @param array|object $objects
  *
  * @throws UnexpectedTypeException
  */
 public function persist($objects)
 {
     if (!is_array($objects) && !$objects instanceof \Traversable) {
         $objects = array($objects);
     }
     foreach ($objects as $object) {
         if (!is_object($object)) {
             throw new UnexpectedTypeException($object, 'object');
         }
         $this->unitOfWork->persist($object);
     }
 }