/** * 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); } }