Wednesday, December 4, 2013

Re: Virtual Field + Concat and find problems

You cannot search a virtualField... it is virtual.

You'll have to search the columns directly.

On Thu, Dec 5, 2013 at 3:17 AM, André Luis <cavallari@live.com> wrote:
> Hi everyone, i have a table "clients" wich the model is "Client"... and in
> my table I have the fields "city" and "state" and others... Also I have the
> following virtualfield:
> public $virtualFields = array(
> 'local'=>"CONCAT(Client.city,' - ',Client.state)",
> );
>
> When i use a find "all" with the conditions 'Client.local'=>'Cascavel - PR'
> it works perfectly... but if I try to find with the conditions
> 'Client.local'=>array('Cascavel - PR','Toledo - PR'), cake gives me an error
> saying that the field Client.local doesnt exists...
>
> Does anyone know where i am wrong??
>
> --
> 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 cake-php+unsubscribe@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/groups/opt_out.



--
Simon Males

--
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 cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: