Tuesday, November 30, 2010

Re: Associations in app_controller.php

Hi,

Are you sure that Link model has belongsTo relationship with Menu model?

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Mon, Nov 29, 2010 at 9:33 PM, pablosky <pablo005_1@hotmail.com> wrote:
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

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: