I have a brainteaser about virtual fields on associated models. I know it has it's limitations as you can read here: http://book.cakephp.org/2.0/en/models/virtual-fields.html#limitations-of-virtualfields.--
But in my specific case, I can't apply the theory of passing the virtualField property from one model to another (even when I read this topic: http://stackoverflow.com/questions/14630819/using-virtual-fields-in-cakephp-2-x).
I'll try to explane my case as clear as possible.
I have 3 tables to make a navigation on my website:
One page can be added to multiple menus, that's why I've made a link table (menu_page_links) between menus and pages.
Now in my application, I want to load a specific menu on every page, e.g. the "Primary menu" from the "menus" table.
So in AppController.php, I referred to the tree needed models ("Menu", "Page" and "MenuPageLink") as following:
Then I get my menu pages that belongs to my specific menu with id "2":
This is my result when I debug my $menu variable:
So far so good!
What I'm trying
And here comes my problem. I only want to select the pages where depth = 1. I tried to make a new "conditions" parameter:
and after a lot of headaches to make this work, I even tried to use the Model::query() method:
I keep getting the sql error, but I don't know how to solve it. As I said, I don't know how to apply the theory in de CakePHP docs (http://book.cakephp.org/2.0/en/models/virtual-fields.html#limitations-of-virtualfields) to my specific case.
Is there anybody who can help me out with this please?
You would be a hero to me :)
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
|Free forum by Nabble||Edit this page|