getContext()->getForeignRecordFinder(); $fkeys = $this->findForeignKeys($fkObject, $this->getSourceRecord()); $properties = array_values($fkeys); $fields = array_keys($fkeys); $indexValues = $this->getIndexValues($properties, $results); $fkObjects = $this->findForeignObjects($fields,$indexValues); $this->populateResult($results,$properties,$fkObjects,$fields); } /** * Sets the foreign objects to the given property on the source object. * @param TActiveRecord source object. * @param array foreign objects. */ protected function setObjectProperty($source, $properties, &$collections) { $hash = $this->getObjectHash($source, $properties); $prop = $this->getContext()->getProperty(); if(isset($collections[$hash]) && count($collections[$hash]) > 0) { if(count($collections[$hash]) > 1) throw new TActiveRecordException('ar_belongs_to_multiple_result'); $source->{$prop} = $collections[$hash][0]; } } } ?>