Re: HABTM QUestio: Getting all non related data

2010-04-07 Thread cricket
Run the find on the join model. But, first, you should use the Cake default naming. The model should be ProjectUser and the table projects_users. Put this in your Project model: public function getAvailableProjects($user_id) { return $this->ProjectUser->find( 'all',

Re: HABTM QUestio: Getting all non related data

2010-04-07 Thread Renato de Freitas Freire
Thanks for the answer... but, is the NOT IN the best way to do this? I mean... cake doesnt have an own way to retrieve all no releated data? Other question: This way, cake will take the array and compare with each record on my db? Cause it may take too long to exectue, since the system will have

Re: HABTM QUestio: Getting all non related data

2010-04-06 Thread Jeremy Burns
There is a reference to "NOT IN" in the guide - I am sure you could adapt that? http://book.cakephp.org/view/1030/Complex-Find-Conditions Jeremy Burns jeremybu...@me.com On 6 Apr 2010, at 17:13, Renato de Freitas Freire wrote: > Hi all. > Sorry if its a noob question, but I cant find it anywher

HABTM QUestio: Getting all non related data

2010-04-06 Thread Renato de Freitas Freire
Hi all. Sorry if its a noob question, but I cant find it anywhere... So... I have this two tables: Users: id - int username - varchar password - varchar created - datetime Projects: id - int name - varchar created - datetime and this HABTM table: User_Projects: id - int user_id - int project_i