Sunday, March 17, 2013

Re: More than one virtualField

On Fri, Mar 15, 2013 at 6:27 AM, Jerome Walitzek
<jerome.walitzek@t-online.de> wrote:
> Hi there,
>
> i have more than 12 Models. But for me are only 2 Models important. "User"
> and "Event"
> in the User Model i have set 2 virtualFields
>
> public $virtualFields = array(
> 'full_name' => 'CONCAT(User.vorname, " ", User.nachname)',
> 'userkennzeichen' => 'CONCAT(User.vorname, " ", User.nachname, "
> - Kennzeichen: ", User.einsetzbarin)'
> );
>
>
> Now i try to get the "userkennzeichen" virtualField in a HABTM listing in my
> Event Controller.
>
> How i can do this when i have set conditions too
>
> $drivers = $this->Event->User->find('list', array('conditions' =>
> array('User.role' => 'driver')));

I'm not sure if this has anything to do with it (you didn't post any
error messages) but have a look here:

http://book.cakephp.org/2.0/en/models/virtual-fields.html#limitations-of-virtualfields

--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: