PHP Класс Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList

Наследование: extends Symfony\Component\Form\Extension\Core\ChoiceList\ArrayChoiceList
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( EntityManager $em, $class, $property = null, $queryBuilder = null, $choices = [] )
getEntities ( ) : array Returns the according entities for the choices
getEntity ( string $key ) : object Returns the entity for the given key
getIdentifier ( )
getIdentifierValues ( object $entity ) Returns the values of the identifier fields of an entity

Защищенные методы

Метод Описание
load ( ) : array Initializes the choices and returns them

Приватные методы

Метод Описание
getReflProperty ( string $property ) : ReflectionProperty Returns the \ReflectionProperty instance for a property of the underlying class
loadEntities ( $entities, $group = null ) Convert entities into choices with support for groups

Описание методов

__construct() публичный Метод

public __construct ( EntityManager $em, $class, $property = null, $queryBuilder = null, $choices = [] )
$em Doctrine\ORM\EntityManager

getEntities() публичный Метод

If the choices were not initialized, they are initialized now. This is an expensive operation, except if the entities were passed in the "choices" option.
public getEntities ( ) : array
Результат array An array of entities

getEntity() публичный Метод

If the underlying entities have composite identifiers, the choices are initialized. The key is expected to be the index in the choices array in this case. If they have single identifiers, they are either fetched from the internal entity cache (if filled) or loaded from the database.
public getEntity ( string $key ) : object
$key string The choice key (for entities with composite identifiers) or entity ID (for entities with single identifiers)
Результат object The matching entity

getIdentifier() публичный Метод

public getIdentifier ( )

getIdentifierValues() публичный Метод

Doctrine must know about this entity, that is, the entity must already be persisted or added to the identity map before. Otherwise an exception is thrown.
public getIdentifierValues ( object $entity )
$entity object The entity for which to get the identifier

load() защищенный Метод

If the entities were passed in the "choices" option, this method does not have any significant overhead. Otherwise, if a query builder was passed in the "query_builder" option, this builder is now used to construct a query which is executed. In the last case, all entities for the underlying class are fetched from the repository.
protected load ( ) : array
Результат array An array of choices