Cake

[email protected] (Philip Thompson)
Newsgroups php.general
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.