ORMQueryBuilderLoader

class ORMQueryBuilderLoader implements EntityLoaderInterface

Loads entities using a {@link QueryBuilder} instance.

Methods

__construct(QueryBuilder|Closure $queryBuilder, ObjectManager $manager = null, string $class = null)

Construct an ORM Query Builder Loader.

array getEntities()

Returns an array of entities that are valid choices in the corresponding choice list.

array getEntitiesByIds(string $identifier, array $values)

Returns an array of entities matching the given identifiers.

Details

__construct(QueryBuilder|Closure $queryBuilder, ObjectManager $manager = null, string $class = null)

Construct an ORM Query Builder Loader.

Parameters

QueryBuilder|Closure $queryBuilder The query builder or a closure for creating the query builder. Passing a closure is deprecated and will not be supported anymore as of Symfony 3.0.
ObjectManager $manager Deprecated
string $class Deprecated

Exceptions

UnexpectedTypeException

array getEntities()

Returns an array of entities that are valid choices in the corresponding choice list.

Return Value

array The entities

array getEntitiesByIds(string $identifier, array $values)

Returns an array of entities matching the given identifiers.

Parameters

string $identifier The identifier field of the object. This method is not applicable for fields with multiple identifiers.
array $values The values of the identifiers

Return Value

array The entities

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/2.7/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.html