summaryrefslogtreecommitdiff
path: root/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php')
-rw-r--r--framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php b/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php
index d7278d64..d4ff07e5 100644
--- a/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php
+++ b/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php
@@ -77,8 +77,7 @@ class TActiveRecordBelongsTo extends TActiveRecordRelation
*/
protected function collectForeignObjects(&$results)
{
- $fkObject = $this->getContext()->getForeignRecordFinder();
- $fkeys = $this->findForeignKeys($this->getSourceRecord(),$fkObject);
+ $fkeys = $this->getRelationForeignKeys();
$properties = array_keys($fkeys);
$fields = array_values($fkeys);
@@ -87,6 +86,16 @@ class TActiveRecordBelongsTo extends TActiveRecordRelation
$fkObjects = $this->findForeignObjects($fields, $indexValues);
$this->populateResult($results,$properties,$fkObjects,$fields);
}
+
+ /**
+ * @return array foreign key field names as key and object properties as value.
+ * @since 3.1.2
+ */
+ public function getRelationForeignKeys()
+ {
+ $fkObject = $this->getContext()->getForeignRecordFinder();
+ return $this->findForeignKeys($this->getSourceRecord(),$fkObject);
+ }
/**
* Sets the foreign objects to the given property on the source object.