EntityChoiceList deprecated

class EntityChoiceList extends ObjectChoiceList

deprecated

Deprecated since Symfony 2.7, to be removed in Symfony 3.0. Use {@link DoctrineChoiceLoader} instead.

A choice list presenting a list of Doctrine entities as choices.

Methods

__construct(ObjectManager $manager, string $class, string $labelPath = null, EntityLoaderInterface $entityLoader = null, array|Traversable|null $entities = null, array $preferredEntities = array(), string $groupPath = null, PropertyAccessorInterface $propertyAccessor = null)

Creates a new entity choice list.

array getChoices()

Returns the list of entities.

array getValues()

Returns the values for the entities.

array getPreferredViews()

Returns the choice views of the preferred choices as nested array with the choice groups as top-level keys.

array getRemainingViews()

Returns the choice views of the choices that are not preferred as nested array with the choice groups as top-level keys.

array getChoicesForValues(array $values)

Returns the entities corresponding to the given values.

array getValuesForChoices(array $entities)

Returns the values corresponding to the given entities.

array getIndicesForChoices(array $entities) deprecated

Returns the indices corresponding to the given entities.

array getIndicesForValues(array $values) deprecated

Returns the entities corresponding to the given values.

Details

__construct(ObjectManager $manager, string $class, string $labelPath = null, EntityLoaderInterface $entityLoader = null, array|Traversable|null $entities = null, array $preferredEntities = array(), string $groupPath = null, PropertyAccessorInterface $propertyAccessor = null)

Creates a new entity choice list.

Parameters

ObjectManager $manager An EntityManager instance
string $class The class name
string $labelPath A property path pointing to the property used for the choice labels. The value is obtained by calling the getter on the object. If the path is NULL, the object's __toString() method is used instead.
EntityLoaderInterface $entityLoader An optional query builder
array|Traversable|null $entities An array of choices or null to lazy load
array $preferredEntities An array of preferred choices
string $groupPath A property path pointing to the property used to group the choices. Only allowed if the choices are given as flat array.
PropertyAccessorInterface $propertyAccessor The reflection graph for reading property paths

array getChoices()

Returns the list of entities.

Return Value

array The choices with their indices as keys

See also

ChoiceListInterface

array getValues()

Returns the values for the entities.

Return Value

array The values with the corresponding choice indices as keys

See also

ChoiceListInterface

array getPreferredViews()

Returns the choice views of the preferred choices as nested array with the choice groups as top-level keys.

Return Value

array A nested array containing the views with the corresponding choice indices as keys on the lowest levels and the choice group names in the keys of the higher levels

See also

ChoiceListInterface

array getRemainingViews()

Returns the choice views of the choices that are not preferred as nested array with the choice groups as top-level keys.

Return Value

array A nested array containing the views with the corresponding choice indices as keys on the lowest levels and the choice group names in the keys of the higher levels

See also

ChoiceListInterface

array getChoicesForValues(array $values)

Returns the entities corresponding to the given values.

Parameters

array $values An array of choice values. Not existing values in this array are ignored

Return Value

array An array of choices with ascending, 0-based numeric keys

See also

ChoiceListInterface

array getValuesForChoices(array $entities)

Returns the values corresponding to the given entities.

Parameters

array $entities

Return Value

array An array of choice values with ascending, 0-based numeric keys

See also

ChoiceListInterface

array getIndicesForChoices(array $entities) deprecated

deprecated

since version 2.4, to be removed in 3.0.

Returns the indices corresponding to the given entities.

Parameters

array $entities

Return Value

array An array of indices with ascending, 0-based numeric keys

See also

ChoiceListInterface

array getIndicesForValues(array $values) deprecated

deprecated

since version 2.4, to be removed in 3.0.

Returns the entities corresponding to the given values.

Parameters

array $values An array of choice values. Not existing values in this array are ignored

Return Value

array An array of indices with ascending, 0-based numeric keys

See also

ChoiceListInterface

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