Thursday, May 27, 2010

Re: Avoiding $uses but binding not giving a result?

Just went back and set recursive to 2 (I was under the impresson I can
set it to -1,0,1; didn't realise there was a 3rd ('2') tier!)
Although I'm getting far too much information in my article array but
it is finally showing the CommentRank! =D

Will try and use find() with contain() later but it works for now.
Thanks!


On 27 May, 10:42, Shaz <shazam...@gmail.com> wrote:
> I've set recursive only for the index, not the view (as I don't need
> comments in the index pagination). I don't suppose I would have to
> declare hasAndBelongsToMany?
>
> Strange; I'm pretty sure somewhere i haven't associated my models
> correctly.
>
> On 27 May, 10:22, Jeremy Burns <jeremybu...@me.com> wrote:
>
> > Have you set recursive anywhere?http://book.cakephp.org/view/439/recursive
>
> > Jeremy Burns
> > jeremybu...@me.com
>
> > On 27 May 2010, at 10:16, Shaz wrote:
>
> > > Thanks all - I went back to the models and checked the belongsto/
> > > hasmany declerations, some plurals where they shouldn't be and no more
> > > errors. But now another delima; how do i get the ranks associated with
> > > the comments?
>
> > > Ideally I would like an array returned like:
>
> > > Article
> > > User
> > > Comment
> > > - Com
> > > - - ComRank
> > > - Com
> > > - - ComRank
> > > - - ComRank
>
> > > And $this->Article->read only gives an array with the following:
>
> > > Article
> > > User
> > > Comment
> > > - Com
> > > - Com
> > > - Com
>
> > > $this->Article->Comment->CommentRank->read() wouldn't work as there's
> > > multiple comments with multiple ranks each...
>
> > > On 27 May, 04:35, Filipe Teles Rodrigues <filipe.t2...@gmail.com>
> > > wrote:
> > >> You are using the plural. Try $this->Article->Comment->CommentsRank
>
> > >> 2010/5/26 Shaz <shazam...@gmail.com>
>
> > >>> I have:
>
> > >>> Article [hasmany] Comment [hasmany] CommentRank
> > >>> CommentRank [belongsto] Comment [belongsto] Article
>
> > >>> I try to use (in the articles controller) $this->Article->Comments-
> > >>>> CommentsRanks->read() but it results in "Undefined property:
> > >>> AppModel::$CommentsRanks"
>
> > >>> I am trying to avoid using $uses as the models are related to one
> > >>> another; but the binding only goes as far as $this->Article->Comments,
> > >>> any advice on why it is not going further? I have tried the different
> > >>> recursive levels to no avail.
>
> > >>> Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers
> > >>> with their CakePHP related questions.
>
> > >>> 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+unsubscribe@googlegroups.com<cake-php%2Bunsubscribe@googlegroups.com>For more options, visit this group at
> > >>>http://groups.google.com/group/cake-php?hl=en
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others with their CakePHP related questions.
>
> > > 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+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: