Merely a wrapper for find... more documentation about it on: http://api.cakephp.org/class/model
2009/7/16 fedekun <fedekil...@gmail.com> > > Thanks! Hmm is there a way to do that on read instead of find? > I have... $this->Post->read(null, $id); > I cant find documentationfor read method though..i just find about > "find", "findAll" etc... > > On 16 jul, 10:59, Carlos Gonzalez Lavin <carloslavi...@gmail.com> > wrote: > > A thorough read of the cookbook is always a good place to start > > I have never tried sorting by two fields, but how about: > > > > *$this->Post->find('all',array('order' => array('Post.created ASC', > > 'Comment.created DESC')));* > > > > if that doesnt work: > > > > *$this->Post->find('all',array('order' => 'Post.created ASC, > Comment.created > > DESC'));* > > > > And you can't do $this->Comment in the Posts Controller because $this > refers > > to an instance of the class (Posts Controller)... and this class by > itself > > doesn't have an instantiated reference to the Comment model's class... > > > > However, due to the defined relationships, cake takes care of making a > > reference of the Comment model instance inside the Post model instance > > (which the Posts Controller can acces through $this->Post).. making it > > accesible by $this->Post->Comment > > > > Hope I didn't confuse you much > > > > 2009/7/15 fedekun <fedekil...@gmail.com> > > > > > > > > > Hi! I have just started with CakePHP and it seems very good so far! > > > But i have a little question... i have a Post model, each post > > > "hasMany" comments, and comments "belongsTo" a Post. > > > So, recursive in the Post model is default, so when i do > > > $this->Post->find('all'); > > > I get all posts and comments, now...If i want to order posts ASC and > > > comments DESC...How do i do it? > > > Also, another thing i dont know...When i'm in the Posts controller, i > > > do > > > $this->Post->find to get posts > > > and $this->Post->Comment->find to get comments > > > Why not $this->Comment->find ? > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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?hl=en -~----------~----~----~----~------~----~------~--~---