/** * Hydrates the list with the necessary unique identifiers. */ public function fetchList() { if ($this->fetched) { return; } $this->fetched = true; // Instantiate an empty instance of the data object class name. $repository = $this->getRepository(); $this->unfetchedRowCount = 0; $this->uniqueIdentifiers = $repository->getUniqueIdentifiersForDataList($this, $this->unfetchedRowCount, $this->relationshipNavigationPropertiesToAutoHydrate); $this->iterator = 0; if ($this->filter !== null) { $uniqueIdentifiersToFilter = $this->filter->getUniqueIdentifiersToFilter($this); $this->uniqueIdentifiers = array_values(array_diff($this->uniqueIdentifiers, $uniqueIdentifiersToFilter)); $this->iterator = 0; } $this->aggregatesNeedingIterated = []; // Build a list of aggregates that need executed as models are pulled from the collection. These will be // the aggregates that could not be handled by the repository. foreach ($this->aggregates as $aggregate) { if (!$aggregate->wasAggregatedByRepository()) { $this->aggregatesNeedingIterated[] = $aggregate; } } if (sizeof($this->sorts)) { $sortedIdentifiers = $repository->getSortedUniqueIdentifiersForDataList($this); if ($sortedIdentifiers != null) { $this->uniqueIdentifiers = $sortedIdentifiers; } } $this->rewind(); }