private function sortObjects(array $objects, $serialize = true)
    {
        $documents = array();
        $serializer = $this->sm->getSerializer();

        foreach ($objects as $object) {
            $document = $serialize ? $serializer->serialize($object) : $object;

            $id = (string) $object->getId();
            if (!$id) {
                throw new DoctrineSearchException('Entity must have an id to be indexed');
            }

            $documents[get_class($object)][$id] = $document;
        }

        return $documents;
    }
private function sortObjects(array $objects, $serialize = true)
    {
        $documents = array();
        $serializer = $this->sm->getSerializer();

        foreach ($objects as $object) {
            $document = $serialize ? $serializer->serialize($object) : $object;

            $id = (string) $object->getId();
            if (!$id) {
                throw new DoctrineSearchException('Entity must have an id to be indexed');
            }

            $documents[get_class($object)][$id] = $document;
        }

        return $documents;
    }
private function sortObjects ( array $ objects , $ serialize = true ) { $ documents = array ( ) ; $ serializer = $ this -> sm -> getSerializer ( ) ; foreach ( $ objects as $ object ) { $ document = $ serialize ? $ serializer -> serialize ( $ object ) : $ object ; $ id = ( string ) $ object -> getId ( ) ; if ( ! $ id ) { throw new DoctrineSearchException ( 'Entity must have an id to be indexed' ) ; } $ documents [ get_class ( $ object ) ] [ $ id ] = $ document ; } return $ documents ; }
Prepare entities for commit. Entities scheduled for deletion do not need
to be serialized.

@param array $objects
@param boolean $serialize
@throws DoctrineSearchException
@return array
Prepare entities for commit . Entities scheduled for deletion do not need to be serialized .