added the fix for ticket #398. also fixed the missing $coll->setReference() in Doctrine_Relation_Association::fetchRelatedFor()
This commit is contained in:
parent
b243286bee
commit
6c0b5fd36c
@ -57,16 +57,11 @@ class Doctrine_Relation_Association extends Doctrine_Relation
|
||||
$component = $this->definition['refTable']->getComponentName();
|
||||
switch ($context) {
|
||||
case "record":
|
||||
$sub = 'SQL:SELECT ' . $this->definition['foreign'].
|
||||
' FROM ' . $this->definition['refTable']->getTableName().
|
||||
' WHERE ' . $this->definition['local'] .
|
||||
' IN (' . substr(str_repeat("?, ", $count),0,-2) .
|
||||
')';
|
||||
|
||||
$sub = substr(str_repeat("?, ", $count),0,-2);
|
||||
$dql = 'FROM ' . $this->getTable()->getComponentName();
|
||||
$dql .= '.' . $component;
|
||||
$dql .= ' WHERE ' . $this->getTable()->getComponentName()
|
||||
. '.' . $this->getTable()->getIdentifier() . ' IN (' . $sub . ')';
|
||||
. '.' . $component . '.' . $this->definition['local'] . ' IN (' . $sub . ')';
|
||||
break;
|
||||
case "collection":
|
||||
$sub = substr(str_repeat("?, ", $count),0,-2);
|
||||
@ -93,6 +88,7 @@ class Doctrine_Relation_Association extends Doctrine_Relation
|
||||
} else {
|
||||
$coll = Doctrine_Query::create()->parseQuery($this->getRelationDql(1))->execute(array($id));
|
||||
}
|
||||
$coll->setReference($record, $this);
|
||||
return $coll;
|
||||
}
|
||||
}
|
||||
|
@ -67,8 +67,8 @@ class Address extends Doctrine_Record
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
$this->hasMany('User', array('local' => 'user_id',
|
||||
'foreign' => 'address_id',
|
||||
$this->hasMany('User', array('local' => 'address_id',
|
||||
'foreign' => 'user_id',
|
||||
'refClass' => 'EntityAddress'));
|
||||
}
|
||||
public function setTableDefinition() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user