0

I have database of library and I would like to display Book detail. Document hasMany Articles and Article hasAndBelongsToMany Authors. In ArticlesController I can see Authors of Articles, but I do not know how to access them in DocumentsController.

Andrew
  • 958
  • 13
  • 25

1 Answers1

2

You need to set the property $recursive to something like 2

$this->Document->recursive = 2;
$this->Document->find('all');

OR you can also use containable behavior

$this->Document->Behaviors->load('Containable');
$this->Document->find('all', array('contain' => array('Article' => 'Author')));
Guillermo Mansilla
  • 3,779
  • 2
  • 29
  • 34