Thursday, March 13, 2014

Tree / parent name (from parent_id) as virtual field

Hi

Ive tried to set up a virtual field in the model to get the parent_name of a "normal" tree in cake. No luck so far :(

Here is the query Ive tried:

public $virtualFields = array(
'parent_name' => 'SELECT Category.name FROM categories as Category WHERE Category.id = Category.parent_id NULL LIMIT 1'
);

I know the virtualField attribute accepts standard SQL-queries, but this does not work.

Could you give me a hint?

Thanks,
Frank

--
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/d/optout.

1 comment:

Sagar said...
This comment has been removed by the author.