Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList
A choice list presenting a list of Doctrine entities as choices
- Author: Bernhard Schussek <bschussek@gmail.com>
Synopsis
class EntityChoiceList
extends ObjectChoiceList
{
- // members
- private ObjectManager $em;
- private string $class;
- private ClassMetadata $classMetadata;
- private EntityLoaderInterface $entityLoader;
- private array $idField;
- private Boolean $idAsIndex;
- private Boolean $idAsValue;
- private Boolean $loaded;
- private array $preferredEntities;
- // methods
- public void __construct()
- public array getChoices()
- public array getValues()
- public array getPreferredViews()
- public array getRemainingViews()
- public array getChoicesForValues()
- public array getValuesForChoices()
- public array getIndicesForChoices()
- public array getIndicesForValues()
- protected integer|string createIndex()
- protected integer|string createValue()
- protected void fixIndex()
- private void load()
- private array getIdentifierValues()
- // Inherited methods from ObjectChoiceList
- public void __construct()
- protected void initialize()
- protected integer|string createValue()
- // Inherited methods from ChoiceList
- public void __construct()
- protected void initialize()
- public void getChoices()
- public void getValues()
- public void getPreferredViews()
- public void getRemainingViews()
- public void getChoicesForValues()
- public void getValuesForChoices()
- public void getIndicesForChoices()
- public void getIndicesForValues()
- protected void addChoices()
- protected void addChoiceGroup()
- protected void addChoice()
- protected Boolean isPreferred()
- protected integer|string createIndex()
- protected string createValue()
- protected string fixValue()
- protected array fixValues()
- protected integer|string fixIndex()
- protected array fixIndices()
- protected mixed fixChoice()
- protected array fixChoices()
Hierarchy
Members
private
- $class — string
- $classMetadata — \Doctrine\Common\Persistence\Mapping\ClassMetadata
- $em — Doctrine\Common\Persistence\ObjectManager
- $entityLoader
—
Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface
Contains the query builder that builds the query for fetching the entities - $idAsIndex
—
Symfony\Bridge\Doctrine\Form\ChoiceList\Boolean
Whether to use the identifier for index generation - $idAsValue
—
Symfony\Bridge\Doctrine\Form\ChoiceList\Boolean
Whether to use the identifier for value generation - $idField
—
array
The identifier field, if the identifier is not composite - $loaded
—
Symfony\Bridge\Doctrine\Form\ChoiceList\Boolean
Whether the entities have already been loaded. - $preferredEntities
—
array
The preferred entities.
Methods
private
- getIdentifierValues() — Returns the values of the identifier fields of an entity.
- load() — Loads the list with entities.
protected
- createIndex() — Creates a new unique index for this entity.
- createValue() — Creates a new unique value for this entity.
- fixIndex() — {@inheritdoc}
public
- __construct() — Creates a new entity choice list.
- getChoices() — Returns the list of entities
- getChoicesForValues() — Returns the entities corresponding to the given values.
- getIndicesForChoices() — Returns the indices corresponding to the given entities.
- getIndicesForValues() — Returns the entities corresponding to the given values.
- getPreferredViews() — Returns the choice views of the preferred choices as nested array with the choice groups as top-level keys.
- getRemainingViews() — Returns the choice views of the choices that are not preferred as nested array with the choice groups as top-level keys.
- getValues() — Returns the values for the entities
- getValuesForChoices() — Returns the values corresponding to the given entities.
Inherited from Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList
protected
- createValue() — Creates a new unique value for this choice.
- initialize() — Initializes the list with choices.
Inherited from Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList
protected
- addChoice() — Adds a new choice.
- addChoiceGroup() — Recursively adds a choice group.
- addChoices() — Recursively adds the given choices to the list.
- createIndex() — Creates a new unique index for this choice.
- createValue() — Creates a new unique value for this choice.
- fixChoice() — Fixes the data type of the given choice to avoid comparison problems.
- fixChoices() — Fixes the data type of the given choices to avoid comparison problems.
- fixIndex() — Fixes the data type of the given choice index to avoid comparison problems.
- fixIndices() — Fixes the data types of the given choice indices to avoid comparison problems.
- fixValue() — Fixes the data type of the given choice value to avoid comparison problems.
- fixValues() — Fixes the data types of the given choice values to avoid comparison problems.
- initialize() — Initializes the list with choices.
- isPreferred() — Returns whether the given choice should be preferred judging by the given array of preferred choices.
public
- getChoices() — {@inheritdoc}
- getChoicesForValues() — {@inheritdoc}
- getIndicesForChoices() — {@inheritdoc}
- getIndicesForValues() — {@inheritdoc}
- getPreferredViews() — {@inheritdoc}
- getRemainingViews() — {@inheritdoc}
- getValues() — {@inheritdoc}
- getValuesForChoices() — {@inheritdoc}