/** * Loads the list with model objects. */ private function load() { $models = (array) $this->query->find(); try { // The second parameter $labels is ignored by ObjectChoiceList // The third parameter $preferredChoices is currently not supported parent::initialize($models, array(), array()); } catch (StringCastException $e) { throw new StringCastException(str_replace('argument $labelPath', 'option "property"', $e->getMessage()), null, $e); } $this->loaded = true; }
/** * Loads the complete choice list entries, once. * * If data has been loaded the choice list is initialized with the retrieved data. */ private function load() { if ($this->loaded) { return; } $models = (array) $this->query->find(); $preferred = array(); if ($this->preferredQuery instanceof ModelCriteria) { $preferred = (array) $this->preferredQuery->find(); } try { // The second parameter $labels is ignored by ObjectChoiceList parent::initialize($models, array(), $preferred); $this->loaded = true; } catch (StringCastException $e) { throw new StringCastException(str_replace('argument $labelPath', 'option "property"', $e->getMessage()), null, $e); } }
/** * Loads the list with entities. */ private function load() { if ($this->entityLoader) { $entities = $this->entityLoader->getEntities(); } else { $entities = $this->em->getRepository($this->class)->findAll(); } try { // The second parameter $labels is ignored by ObjectChoiceList // The third parameter $preferredChoices is currently not supported parent::initialize($entities, array(), array()); } catch (StringCastException $e) { throw new StringCastException(str_replace('argument $labelPath', 'option "property"', $e->getMessage()), null, $e); } $this->loaded = true; }
/** * Loads the list with entities from repository. * * @throws Exception * @throws \EasyRdf\Http\Exception */ private function load() { try { if ($this->queryBuilder) { $resources = (new NemrodQueryBuilderLoader($this->queryBuilder, $this->rm, $this->class))->getResources(Query::HYDRATE_COLLECTION, ['rdf:type' => $this->class]); // The second parameter $labels is ignored by ObjectChoiceList if ($resources) { parent::initialize($resources, array(), $this->preferredResources); } } } catch (StringCastException $e) { throw new StringCastException(str_replace('argument $labelPath', 'option "property"', $e->getMessage()), null, $e); } $this->loaded = true; }