summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgodzilla80@gmx.net <>2009-05-14 07:40:17 +0000
committergodzilla80@gmx.net <>2009-05-14 07:40:17 +0000
commited95b343dd11a3c5136d33dcb55ab11d75c551a9 (patch)
tree33d4f3d3a6340173301e1db5b3fb74a32a3a00af
parent3e31c85df41985e4bc1fa1da045c02e96043ea2a (diff)
Fixed Issue#78 - add schema support to TActiveRecordRelation::findForeignKeys()
-rw-r--r--HISTORY1
-rw-r--r--framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php7
2 files changed, 6 insertions, 2 deletions
diff --git a/HISTORY b/HISTORY
index 76871038..61cf7150 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,6 +1,7 @@
Version 3.1.5 (to be released)
BUG: Issue#55 - TPropertyAccess.get and has don't recognize magic getter __get (Yves)
BUG: Issue#68 - TSqlMapConfig::createSqlMapGateway(): assign current connection to cached TSqlMapManager to avoid loosing active transaction (Yves)
+BUG: Issue#78 - add schema support to TActiveRecordRelation::findForeignKeys() (Yves)
BUG: Issue#87 - TinyMCE : empty string disapears after encoding JS, that's a problem! (Christophe)
BUG: Issue#88 - SQLMap $Param$ re-evaluation bug (Yves)
BUG: Issue#95 - TMysqlMetaData::getShowCreateTable() throws TPhpErrorException "[Notice] Undefined index: Create Table" if table is a view (Yves)
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'];