Vinayak Phal
Vinayak Phal

Reputation: 8919

CakePHP: Containable behaviour how to restrict the same tables field

I've a table with a more then 15 fields and having several relations.

After using containable behavior I've full control over the other related table. But I do not want all the fields of main table.

How can I restrict the fields of the main table by using containable behavior.

Thanks in advance!!

@Vins

Upvotes: 1

Views: 171

Answers (1)

mensch
mensch

Reputation: 4411

That would be:

$this->Model->find('all', array(
  'fields' => array('field', 'field'),
  'contain' => array(
    'relatedModel',
    'relatedModel'
  )
));

You can pass order, limit and condition clauses as well this way.

Upvotes: 1

Related Questions