$this->User->Post->find(array('Post.user_id' => $user['User']['id']);
it would search in all posts that have the user_id set to $user['User']
['id'].
its the same as when you have Post in uses
$this->Post->find(array('Post.user_id' => $user['User']['id']);You will always learn new things cause cake is developing rapidly and its impossible to learn everything for the first app. On Aug 11, 12:17 pm, CakeSpork <[EMAIL PROTECTED]> wrote: > Now that I'm finishing my first 'real' cake app which will actually > have to be used and such, I'm regretting the decisions I made in the > beginning more and more. I'm glad everything works, but every time I > find out something new I could have used in the base design it stings. > > In an effort to prevent this in the future I'm now going to try to > learn it all over again, and try to retain a little more. One thing > I'm now a little confused about is the way associated models can be > called. In the aforementioned app, I used $uses to gain access to > other models, like users. So when people used the searchbox in > (something like) posts, it used $user = $this->User->findByUsername($...) and > the $this->Post->findByWriter($user['User'] > > ['id']). > > My question is, could I have used something like > $this->User->Post->findByWriter? And where would it search in that case, in > all Posts or > > only in the posts associated with the _current_ User? I looked in the > manual but the only thing there was about this sort of thing that I > found was to save associated model data. > > Thanks a bunch! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
