diff options
author | godzilla80@gmx.net <> | 2009-05-14 07:40:17 +0000 |
---|---|---|
committer | godzilla80@gmx.net <> | 2009-05-14 07:40:17 +0000 |
commit | ed95b343dd11a3c5136d33dcb55ab11d75c551a9 (patch) | |
tree | 33d4f3d3a6340173301e1db5b3fb74a32a3a00af /framework | |
parent | 3e31c85df41985e4bc1fa1da045c02e96043ea2a (diff) |
Fixed Issue#78 - add schema support to TActiveRecordRelation::findForeignKeys()
Diffstat (limited to 'framework')
-rw-r--r-- | framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php b/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php index 85dd6735..a3daf35c 100644 --- a/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php +++ b/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php @@ -109,14 +109,17 @@ abstract class TActiveRecordRelation protected function findForeignKeys($from, $matchesRecord, $loose=false)
{
$gateway = $matchesRecord->getRecordGateway();
- $matchingTableName = $gateway->getRecordTableInfo($matchesRecord)->getTableName();
+ $recordTableInfo = $gateway->getRecordTableInfo($matchesRecord);
+ $matchingTableName = strtolower($recordTableInfo->getTableName());
+ $matchingFullTableName = strtolower($recordTableInfo->getTableFullName());
$tableInfo=$from;
if($from instanceof TActiveRecord)
$tableInfo = $gateway->getRecordTableInfo($from);
//find first non-empty FK
foreach($tableInfo->getForeignKeys() as $fkeys)
{
- if(strtolower($fkeys['table'])===strtolower($matchingTableName))
+ $fkTable = strtolower($fkeys['table']);
+ if($fkTable===$matchingTableName || $fkTable===$matchingFullTableName)
{
$hasFkField = !$loose && $this->getContext()->hasFkField();
$key = $hasFkField ? $this->getFkFields($fkeys['keys']) : $fkeys['keys'];
|