Quantcast

General condition to all my finds

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

General condition to all my finds

floepi

Hi all,

is is possible to inject a condition into all my find methods. All of
my tables have an active field and i would like to create a global
condidtion for my sql queries that always filter out the records where
active is = 0

Could not find any information about it anywhere.

Thanks for your help.

Cheers

Phil


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: General condition to all my finds

spark-3

 i think you could make it into the model (although it's done in every
model), using 'conditions'  in the association array...

 var $belongsTo = array('User' =>
                           array('className'  => 'User',
                                 'conditions' => '',
                                 'order'      => '',
                                 'foreignKey' => 'user_id'
                           )
                     );

 would be made this way ?

 spark

On 12/1/06, floepi <[hidden email]> wrote:

>
> Hi all,
>
> is is possible to inject a condition into all my find methods. All of
> my tables have an active field and i would like to create a global
> condidtion for my sql queries that always filter out the records where
> active is = 0
>
> Could not find any information about it anywhere.
>
> Thanks for your help.
>
> Cheers
>
> Phil
>
>
> >
>


--
[web] http://synapsisdi.com.br
[livesets] http://djspark.com.br/mp3

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: General condition to all my finds

Christoph Boget-2

>  var $belongsTo = array('User' =>
>                            array('className'  => 'User',
>                                  'conditions' => '',
>                                  'order'      => '',
>                                  'foreignKey' => 'user_id'
>                            )
>                      );

As an aside, is there a bakery article out there somewhere that better
describes what all the keys do in the association arrays?  finderQuery,
conditions, etc?  I've searched but was unable to find anything.  The
documentation is very vague regarding this.

thnx,
Christoph


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: General condition to all my finds

Mariano Iglesias

I think this can be of help:

http://wiki.cakephp.org/docs:understanding_associations

Until someone writes a bakery article, considering that some wiki documents
are outdated. Care to take the challenge Christoph? ;)

-MI

---------------------------------------------------------------------------

Remember, smart coders answer ten questions for every question they ask.
So be smart, be cool, and share your knowledge.

BAKE ON!


-----Mensaje original-----
De: [hidden email] [mailto:[hidden email]] En nombre
de Christoph
Enviado el: Viernes, 01 de Diciembre de 2006 04:06 p.m.
Para: Cake PHP
Asunto: Re: General condition to all my finds

As an aside, is there a bakery article out there somewhere that better
describes what all the keys do in the association arrays?  finderQuery,
conditions, etc?  I've searched but was unable to find anything.  The
documentation is very vague regarding this.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: General condition to all my finds

floepi

Hmm well the conditions are not really what i was looking for. Using
cake's awesome modularity there surely should be a way to add a
condition statement to all my standard cake find methods.

I was thinking down the line of using the app_model.php and add a
beforefind() function that injects my query. Have to find out about the
db module and then add the condition i think.

Will try to keep you posted.

Thanks for the replies.

Cheers

Phil

On Dec 1, 7:49 pm, "Mariano Iglesias" <[hidden email]>
wrote:

> I think this can be of help:
>
> http://wiki.cakephp.org/docs:understanding_associations
>
> Until someone writes a bakery article, considering that some wiki documents
> are outdated. Care to take the challenge Christoph? ;)
>
> -MI
>
> ---------------------------------------------------------------------------
>
> Remember, smart coders answer ten questions for every question they ask.
> So be smart, be cool, and share your knowledge.
>
> BAKE ON!
>
> -----Mensaje original-----
> De: [hidden email] [mailto:[hidden email]] En nombre
> de Christoph
> Enviado el: Viernes, 01 de Diciembre de 2006 04:06 p.m.
> Para: Cake PHP
> Asunto: Re:Generalcondition to all my finds
>
> As an aside, is there a bakery article out there somewhere that better
> describes what all the keys do in the association arrays?  finderQuery,
> conditions, etc?  I've searched but was unable tofindanything.  The
> documentation is very vague regarding this.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Loading...