Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList::load PHP Метод

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
    protected function load()
    {
        parent::load();

        if ($this->choices) {
            $entities = $this->choices;
        } else if ($qb = $this->queryBuilder) {
            $entities = $qb->getQuery()->execute();
        } else {
            $entities = $this->em->getRepository($this->class)->findAll();
        }

        $this->choices = array();
        $this->entities = array();

        $this->loadEntities($entities);

        return $this->choices;
    }

Usage Example

 /**
  * {@inheritdoc}
  */
 protected function load()
 {
     if (!$this->ajax) {
         parent::load();
     }
 }