0
votes
'Tag' => array(
    (int) 0 => array(
        'id' => '1',
        'name' => 'kannada',
        'MoviesTag' => array(
            'id' => '60',
            'movie_id' => '2',
            'tag_id' => '1'
        )
    )
)

I want to fetch Movie from movie_id of Tag in containable.. How to fetch that?

1

1 Answers

0
votes

In your Tag controller try something like this:

$this->Tag->find('all'); // this will return tag with movie detail

OR

if you want to use Containable behavior then try this:

$this->Tag->attach->behaviors('Containable');

$this->Tag->recursive = -1;

$this->Tag->find('all', array(
        'fields' => array('Tag.id', 'Tag.name'),
        'contain' => array(
                         'Movie'
                      )
));