Wednesday, February 24, 2010

Model Association 'chain'

I have 4 models, associated like this:

Model_1 has_many Model_2
Model_2 belongs_to Model_1

Model_2 has_many Model_3
Model_3 belongs_to Model_2

Model_3 has_many Model_4
Model_4 belongs_to Model_3

In my controller, when I call `$my_var = $this->Model_1->find('all')`
the results have Model_1 and Model_2 in them, but I would like it to
recurse down through the whole chain...any thoughts? Should I just do
it manually in a model function?

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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: