Many to Many

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 :frowning: It would be nice if someone has a solution.

Thanks

Bye

Could you please create a ticket for this? This should be supported, but there's a bug when handling this particular scenario.

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.

Thanks. Fix checked in.

That was realy fast :wink: Thanks, i checked it. It worked. Lets see…