Im working with CakePHP since very recently..
I've got a table 'advertisers' and a table 'users', aswell as a table 'advertisers_users', that only contains 'advertiser_id' and 'user_id'. . User hasAndBelongsToMany Advertiser.
I need an array in which i can find all advertisers (names and id's) that habtm to the current user id in my User-Controller. how can i do that in cakephp?
like
$this->User->Advertiser->find('all', array('conditions' => '?'));
Thank you all in advance!
$this->User->find(user_id);
Give an array with (if $this->User->recursive is set to 1 )
Array
(
[User] => Array
(
[id] => 2745
[name] => Chocolate Frosted Sugar Bombs
)
[Advertiser] => Array
(
[0] => Array
(
[id] => 123
[name] => blabla
)
[1] => Array
(
[id] => 124
[name] => blabla
)
[2] => Array
(
[id] => 125
[name] => blabla
)
)
)