Wednesday, November 26, 2008

Re: connecting the many to many dots - going from table1 -> table1_table2 -> table 2

Thank you. Searching for 'modelizing the join table' brought me to the
Mariano Iglesias article "Modelizing HABTM join tables in CakePHP 1.2:
with and auto-with models".
here: http://www.cricava.com/blogs/index.php?blog=6&title=modelizing_habtm_join_tables_in_cakephp_&more=1&c=1&tb=1&pb=1

This talks about how to call the models manually, which is a start,
but I need the conditions to come from the user through the use of a
form.

One of the examples is this: $joinRecords = $this->Article-
>ArticlesTag->find('all', array('ArticlesTag.tag_id' => 3));
Where the ArticlesTag.tag_id => 3 can i replace 3 with an array? As I
said before, when I call $this->data I get an array of category id's
that the user has chosen so something along the lines of placing that
data into a variable and the variable in the 3 position seems to be
about what i need. Except for that this doesn't work and I'm not sure
what else to try.

Kyo wrote:
> You can retrieve data from a HABTM relationship either by modelizing
> the join table or using 'with' key of the model association.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: