Tuesday, August 23, 2011

Re: afterFind : possible to get query type?

Hi Teddy,

I really would love to upgrade! But this is a huge legacy application
with some changes in the core and I guess an upgrade would need about
two weeks, which isn't possible without a very very very good reason to
tell my manager.

I will do the checks in the controller instead.

Anja ( aka acl68)

Am 22.08.2011 19:51, schrieb Teddy Zeenny:
> I guess you'll need to upgrade to v 1.3 because it seems
> Model::findQueryType is resetting before the afterFind method. (check
> this link:
> http://groups.google.com/group/tickets-cakephp/msg/5ed5fd51805bd232)
>
> or you can maybe do something like this:
>
> var _tempFindQueryType;
>
> function beforeFind()
> {
> $this->_tempFindQueryType=$this->findQueryType;
> }
>
> function afterFind($results)
> {
> $findQueryType=$this->_tempFindQueryType;
> }
>
>
>
> On Mon, Aug 22, 2011 at 7:49 PM, acl68 <cake@anjaliebermann.de
> <mailto:cake@anjaliebermann.de>> wrote:
>
> I am using Cake 1.2. .
>
> I put $this->findQueryType as debug output at the begin of the the
> afterFind
> method and it showed me only "null" before I did anything in the
> method.
>
> Anja
>
> Am Montag, 22. August 2011, um 16:59:09 schrieb Teddy Zeenny:
> > As Thomas said, $this->findQueryType should definitely work in the
> > afterFind().
> >
> > Which version of cakephp are you using ?
> > Can you show us the afterFind code ?
> >
> > On Mon, Aug 22, 2011 at 5:55 PM, Anja Liebermann <
> >
> > anja.liebermann@platinnetz.de
> <mailto:anja.liebermann@platinnetz.de>> wrote:
> > > But I need the value IN the afterFind method. Not before or after.
> > >
> > > Well I do the checks now in the index and view methods of the
> controller.
> > >
> > > Anja
> > >
> > > Am 22.08.2011 16:39, schrieb Thomas Ploch:
> > > The findQueryType is reset before afterFind() is executed. So
> assigning
> > >
> > >> the value to a class var in beforeFind() and reading it in
> afterFind()
> > >> should work.
> > >>
> > >> :-)
> > >>
> > >> Am 22.08.2011 16:33, schrieb Anja Liebermann:
> > >>> did that. It is always NULL :(
> > >>>
> > >>> Anja
> > >>>
> > >>> Am 22.08.2011 16:25, schrieb Thomas Ploch:
> > >>>> Look at Model::findQueryType :-)
> > >>>>
> > >>>> Am 22.08.2011 15:56, schrieb Anja Liebermann:
> > >>>>> Hello,
> > >>>>>
> > >>>>> is there a possibility to know which query type ( first,
> all, count
> > >>>>> etc...) was used, when I call afterFind()?
> > >>>>>
> > >>>>> Depending on the query Type I would like to make different
> checks.
> > >>>>>
> > >>>>> If it is not possible, then I have to do it in the
> controller in
> > >>>>> several actions.
> > >>>>>
> > >>>>>
> > >>>>> As always: Thanks in advance for any hints!
> > >>>>>
> > >>>>> Anja
> > >
> > > --
> > > 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+unsubscribe@**googlegroups.com
> <http://googlegroups.com><cake-php%2Bunsubscribe@googlegrou
> > > ps.com <http://ps.com>>For more options, visit this group at
> > >
> http://groups.google.com/**group/cake-php<http://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+unsubscribe@googlegroups.com
> <mailto:cake-php%2Bunsubscribe@googlegroups.com> For more options,
> visit this group at http://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+unsubscribe@googlegroups.com For more options, visit this group
> at http://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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: