Form\ChoiceList\DoctrineChoiceLoader (Bridge\Doctrine)
Symfony\Bridge\Doctrine\Form\ChoiceList\DoctrineChoiceLoader
class DoctrineChoiceLoader implements ChoiceLoaderInterface
Loads choices using a Doctrine object manager.
Methods
__construct(ChoiceListFactoryInterface $factory, ObjectManager $manager, string $class, IdReader $idReader = null, EntityLoaderInterface $objectLoader = null) Creates a new choice loader. | ||
ChoiceListInterface | loadChoiceList(null|callable $value = null) Loads a list of choices. | |
string[] | loadValuesForChoices(array $choices, null|callable $value = null) Loads the values corresponding to the given choices. | |
array | loadChoicesForValues(array $values, null|callable $value = null) Loads the choices corresponding to the given values. |
Details
public __construct(ChoiceListFactoryInterface $factory, ObjectManager $manager, string $class, IdReader $idReader = null, EntityLoaderInterface $objectLoader = null)
Creates a new choice loader.
Optionally, an implementation of {@link EntityLoaderInterface} can be passed which optimizes the object loading for one of the Doctrine mapper implementations.
public ChoiceListInterface loadChoiceList(null|callable $value = null)
Loads a list of choices.
Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument.
public string[] loadValuesForChoices(array $choices, null|callable $value = null)
Loads the values corresponding to the given choices.
The values are returned with the same keys and in the same order as the corresponding choices in the given array.
Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument.
public array loadChoicesForValues(array $values, null|callable $value = null)
Loads the choices corresponding to the given values.
The choices are returned with the same keys and in the same order as the corresponding values in the given array.
Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument.
© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.html