I have a Model ("Model_1") which is related to itself by a second
model ("Model_2") by a HABTM relation. Model_2 uses a custom table
(var $usetable = "model_1")

The problem: When I make a find call on Model_1, it returns correctly
the row for itself, and the correct number of rows for Model_2, BUT
all the rows of Model_2 contain the information of Model_1!

For example, I have the model "tag" related with habtm to "tag2" (tag2
has useTable tag). When I query tag for a specific entry, I get tag
and the correct number of tag2, but every tag2 contains the data of
the one tag row.

There is a workaround: when I define the foreignKey and
associationForeignKey and exchange their values, it works!
Like (for Model_1):  'foreignKey' =>
'model_1_id','associationForeignKey' => 'model_2_id'. If I don't
define it, or if I defined it the correct way ( 'foreignKey' =>
'model_2_id','associationForeignKey' => 'model_1_id') I get the
problem described above.

The SQL generated, however is correct and the same in both szenarios
(and it returns correct results when I try it manually in PhpMyAdmin).
It seems that Cake internally gets the results wrong inside its model
functions.

Is anyone able to reproduce this?

Thanks,
Stefan


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to