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);
        }
    }
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);
        }
    }
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 ) ; } }
Adds the object to the index

@param array|object $objects

@throws UnexpectedTypeException
Adds the object to the index