/** * Parse single result row to generate data tree. Must pass parsing to every nested loader. * * @param array $row * @return bool */ private function parseRow(array $row) { if (!$this->isLoadable()) { //Nothing to parse, we are no waiting for any data return; } //Fetching only required part of resulted row $data = $this->fetchData($row); if (empty($this->parent)) { if ($this->deduplicate($data)) { //Yes, this is reference, i'm using this method to build data tree using nested parsers $this->result[] =& $data; //Registering references to simplify tree compilation for post and inner loaders $this->collectReferences($data); } $this->parseNested($row); return; } if (!($referenceCriteria = $this->fetchCriteria($data))) { //Relation not loaded return; } if ($this->deduplicate($data)) { //Registering references to simplify tree compilation for post and inner loaders $this->collectReferences($data); } //Mounting parsed data into parent under defined container $this->parent->mount($this->container, $this->getReferenceKey(), $referenceCriteria, $data, static::MULTIPLE); $this->parseNested($row); }