Hi Experts,
any help?
Thanks in advance.
On Friday, January 16, 2015 at 12:47:39 AM UTC+5:30, José Lorenzo wrote:
>
> Even though that is possible you are tying to do it the hard way. The
> easiest way you can implement the same is by using the query as a "command"
> object,
> thus instructing the custom finders to do stuff based on the passed
> options. An example
>
> $table->find('forUser', ['user' => $user])->find('withStatus', ['status'
> => 'active']);
>
> Then in your table you would create your finders this way:
>
> public function finWithStatus($query, $options) {
> if (!empty($options['user'])) {
> // The user is available from the previous finder, I can add more
> conditions here based on that
> }
> }
>
>
> I guess the best way I can help you find the best strategy is if you
> mention what exactly you are trying to do :D
> On Thursday, January 15, 2015 at 3:26:09 PM UTC+1, Cake Developer wrote:
>>
>> Hello,
>>
>> I am trying to get and modify query conditions in beforeFind function of
>> Behaviour.
>>
>> function beforeFind(Event $event, Query $query, $options, $primary) {
>> // here is what I tried so far.
>> $conditions = $query->clause('where');
>> // this gives me Object of Expression Interface and I am not able to
>> convert it in condition array like we have in cakephp 2.x
>>
>> //what I want to achieve...
>> //I want to modify existing conditions in query.
>> //I want to add new condition in query
>>
>> }
>>
>> I spent last 2 days but could not figure out any solution.
>> Thanks for any help you may be able to provide regarding this.
>>
>>
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.