system
(system)
December 8, 2008, 9:59pm
1
Hi,
i am trying to realize a many to many relationship with one two tables.
User -> user_fried -> User
Actually i am facing troubles in the CActiveFinder in the method getJoinCondition. This is because the childCondition does not get recognized. Both definition are taken as parent table.
Does somebody know if this is possible somehow? PHPDoctrine can do that It would be nice if someone has a solution.
Thanks
Bye
qiang
(Qiang Xue)
December 8, 2008, 10:17pm
2
Could you please create a ticket for this? This should be supported, but there's a bug when handling this particular scenario.
system
(system)
December 8, 2008, 10:23pm
3
I did a quick test…
foreach($fks as $fk)
{$i++;
if(isset($joinTable->foreignKeys[$fk]))
{
list($tableName,$pk)=$joinTable->foreignKeys[$fk];
if($i==1 && $schema->compareTableNames($parent->_table->rawName,$tableName))
$parentCondition[]=$parent->getColumnPrefix().$schema->quoteColumnName($pk).'='.$joinAlias.'.'.$schema->quoteColumnName($fk);
else if($schema->compareTableNames($this->_table->rawName,$tableName))
$childCondition[]=$this->getColumnPrefix().$schema->quoteColumnName($pk).'='.$joinAlias.'.'.$schema->quoteColumnName($fk);
so that the first is parent, the second child, everything seemed to work, now is up to you to make it a beautiful code
Ok i create a ticket.
Thanks.
I have one more question, but i will post it in an own thread.
system
(system)
December 9, 2008, 12:17am
5
That was realy fast Thanks, i checked it. It worked. Lets see…