Jelle De Loecker
Jelle De Loecker

Reputation: 21945

Using contain in CakePHP

I have a model that looks like this:

Performance
    - Location
    - Event
        - Location (Another one)
        - A bunch of other stuff

When I set the recursiveness to 2 I get way too much data (the "a bunch of other stuff") When I use contain('Location') I only get the "Location" model directly under Performance, not under Event...

How do I get that data?

Upvotes: 1

Views: 253

Answers (1)

Andreas Wong
Andreas Wong

Reputation: 60516

Have you tried (Assuming from controller):

$this->Performance->find('all', array(
   'contain' => array('Event' => 'Location')
));

Upvotes: 2

Related Questions