lib/Yucca/Form/ChoiceList/ChoiceLoader.php
public function loadChoiceList($value = null)
    {
        if (is_null($value)) {
            $value = function ($choice) {
                if ($choice instanceof \Yucca\Model\ModelInterface) {
                    return $choice->getId();
                } else {
                    return (string) $choice;
                }
            };
        }

        if ($this->choiceList) {
            return $this->choiceList;
        }

        if ($this->iterator) {
            if (is_array($this->iterator)) {
                $entities = $this->iterator;
            } else {
                $entities = $this->iterator->getArray();
            }
        } else {
            $selector = $this->entityManager->getSelectorManager()->getSelector($this->selectorClassName);
            $iterator = new Iterator(
                $selector,
                $this->entityManager,
                $this->modelClassName
            );
            $entities = $iterator->getArray();
        }

        $this->choiceList = $this->factory->createListFromChoices($entities, $value);

        return $this->choiceList;
    }
public function loadChoiceList($value = null)
    {
        if (is_null($value)) {
            $value = function ($choice) {
                if ($choice instanceof \Yucca\Model\ModelInterface) {
                    return $choice->getId();
                } else {
                    return (string) $choice;
                }
            };
        }

        if ($this->choiceList) {
            return $this->choiceList;
        }

        if ($this->iterator) {
            if (is_array($this->iterator)) {
                $entities = $this->iterator;
            } else {
                $entities = $this->iterator->getArray();
            }
        } else {
            $selector = $this->entityManager->getSelectorManager()->getSelector($this->selectorClassName);
            $iterator = new Iterator(
                $selector,
                $this->entityManager,
                $this->modelClassName
            );
            $entities = $iterator->getArray();
        }

        $this->choiceList = $this->factory->createListFromChoices($entities, $value);

        return $this->choiceList;
    }
public function loadChoiceList ( $ value = null ) { if ( is_null ( $ value ) ) { $ value = function ( $ choice ) { if ( $ choice instanceof \ Yucca \ Model \ ModelInterface ) { return $ choice -> getId ( ) ; } else { return ( string ) $ choice ; } } ; } if ( $ this -> choiceList ) { return $ this -> choiceList ; } if ( $ this -> iterator ) { if ( is_array ( $ this -> iterator ) ) { $ entities = $ this -> iterator ; } else { $ entities = $ this -> iterator -> getArray ( ) ; } } else { $ selector = $ this -> entityManager -> getSelectorManager ( ) -> getSelector ( $ this -> selectorClassName ) ; $ iterator = new Iterator ( $ selector , $ this -> entityManager , $ this -> modelClassName ) ; $ entities = $ iterator -> getArray ( ) ; } $ this -> choiceList = $ this -> factory -> createListFromChoices ( $ entities , $ value ) ; return $ this -> choiceList ; }
{@inheritdoc}
{