What is being said is that you have some conventions you didn't follow. As a result, you are writing overly-complicated code to handle what should be automatic within the framework.
Do this: 1) move / rename your users_links table and data to a links_users table inside mysql. 2) remove completely the model for your join table - the UsersLink model. 3) define a normal habtm relationship between the User model and the Link model. 4) read the manual before you start another project - all of this is clearly explained in many translations. On Jul 21, 10:45 am, Jeremy Burns | Class Outfit <jeremybu...@classoutfit.com> wrote: > I think you are not following the conventions, are making life difficult for > yourself and should read the guide. > > Jeremy Burns > Class Outfit > > http://www.classoutfit.com > > On 21 Jul 2011, at 17:05, localhost wrote: > > > > > > > > > Sorry I didn't understand your reply > > > I have defined the relationship > > > class UsersLink extends AppModel { > > var $belongsTo = array( > > 'Link' => array( > > 'className' => 'Link', > > 'foreignKey' => 'link_id', > > 'conditions' => '', > > 'fields' => '', > > 'order' => '' > > ), > > 'User' => array( > > 'className' => 'User', > > 'foreignKey' => 'user_id', > > 'conditions' => '', > > 'fields' => '', > > 'order' => '' > > ) > > ); > > > } > > > What do you mean by "joining table should be links_users (i.e. the > > tables are in alphabetical order)" ? > > > On Jul 21, 6:31 pm, Jeremy Burns | Class Outfit > > <jeremybu...@classoutfit.com> wrote: > >> If you have defined a HABTM relationship your joining table should be > >> links_users (i.e. the tables are in alphabetical order). > > >> Jeremy Burns > >> Class Outfit > > >>http://www.classoutfit.com > > >> On 21 Jul 2011, at 16:26, localhost wrote: > > >>> Hi everyone, > > >>> I have being trying to solve this for the last 4 hours with no luck. > > >>> basically I have the following tables > > >>> users > >>> links > >>> users_links > > >>> Basically I'm trying to get the below query to run using find('all') > >>> and paginate (I'm running this inside UserController) > > >>> SELECT Links.id,Links.Title FROM users,links,users_links WHERE > >>> user.id=1 AND user.id=users_links.user_id AND > >>> users_links.link_id=links.id AND users_links.index=1 > > >>> (see the above sql "users_links.index=1"). > > >>> how to get this working ? > > >>> -- > >>> Our newest site for the community: CakePHP Video > >>> Tutorialshttp://tv.cakephp.org > >>> Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp > >>> others with their CakePHP related questions. > > >>> To unsubscribe from this group, send email to > >>> cake-php+unsubscr...@googlegroups.com For more options, visit this group > >>> athttp://groups.google.com/group/cake-php > > > -- > > Our newest site for the community: CakePHP Video > > Tutorialshttp://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php