Monday, November 29, 2010

Associations in app_controller.php

Hello.

I'm trying to extract data from a table from the app_controller.php.
But the table is related to another table using "belongTo."

This code works:

if (!Cache::read('links')) {
$this->loadModel('Link');
$result = $this->Link->find('all', array('fields' =>
array('Link.id', 'Link.name', 'Link.url')));
Cache::write('links', $result);
}

But this code does not work:

if (!Cache::read('links')) {
$this->loadModel('Link');
$result = $this->Link->find('all', array('fields' =>
array('Link.id', 'Link.name', 'Link.url', 'Menu.alias')));
Cache::write('links', $result);
}

Do not work in app_controller.php relationship?

Thank you!!

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: