src/Fixture/AbstractEntityReferenceFixture.php
protected function getObjectReferences(ObjectManager $objectManager, $className)
    {
        $identifier = $objectManager->getClassMetadata($className)->getIdentifier();
        $idField    = reset($identifier);

        /** @var EntityRepository $objectRepository */
        $objectRepository = $objectManager->getRepository($className);

        $idsResult = $objectRepository
            ->createQueryBuilder('t')
            ->select('t.' . $idField)
            ->getQuery()
            ->getArrayResult();

        $ids = [];
        foreach ($idsResult as $result) {
            $ids[] = $result[$idField];
        }

        return $this->getObjectReferencesByIds($objectManager, $className, $ids);
    }
protected function getObjectReferences(ObjectManager $objectManager, $className)
    {
        $identifier = $objectManager->getClassMetadata($className)->getIdentifier();
        $idField    = reset($identifier);

        /** @var EntityRepository $objectRepository */
        $objectRepository = $objectManager->getRepository($className);

        $idsResult = $objectRepository
            ->createQueryBuilder('t')
            ->select('t.' . $idField)
            ->getQuery()
            ->getArrayResult();

        $ids = [];
        foreach ($idsResult as $result) {
            $ids[] = $result[$idField];
        }

        return $this->getObjectReferencesByIds($objectManager, $className, $ids);
    }
protected function getObjectReferences ( ObjectManager $ objectManager , $ className ) { $ identifier = $ objectManager -> getClassMetadata ( $ className ) -> getIdentifier ( ) ; $ idField = reset ( $ identifier ) ; /** @var EntityRepository $objectRepository */ $ objectRepository = $ objectManager -> getRepository ( $ className ) ; $ idsResult = $ objectRepository -> createQueryBuilder ( 't' ) -> select ( 't.' . $ idField ) -> getQuery ( ) -> getArrayResult ( ) ; $ ids = [ ] ; foreach ( $ idsResult as $ result ) { $ ids [ ] = $ result [ $ idField ] ; } return $ this -> getObjectReferencesByIds ( $ objectManager , $ className , $ ids ) ; }
Returns array of object references.

@param ObjectManager $objectManager
@param string $className
@return array
@see getObjectReferencesByIds
Returns array of object references .