Cake
| From: | Philip Thompson | Date: | Fri, 13 Aug 2010 15:49:36 +0000 |
| Subject: | Cake | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-307434@lists.php.net to get a copy of this message | ||
Hi all.
Having an issue with some CakePHP 1.3 stuff. I've read and read and read and haven't found
my solution. I'm fairly new to Cake, so be nice. I'm trying to access a method from a
different controller than the one I'm in and it's not letting me.
-location.php (model) - create the relationship
public $belongsTo = 'Address';
-locations_controller.php - grab all the locations (+ addresses for each location) and format the
addresses
$locations = $this->Location->find('all');
...
$this->Location->Address->format(...); // This line throws the error
...
-addresses_controller.php
public function format (...) { ... }
From my understanding, everything is defined correctly, but it thinks that I'm calling a query
when it errors:
Warning (512): SQL Error: 1064: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'format' at line
1 [CORE/cake/libs/model/datasources/dbo_source.php, line 681]
It thinks that the method "format()" is a query. Why?! I just want it to call that method.
Please help!
Thanks in advance,
~Philip