Wednesday, August 1, 2012

Getting DB error on calling Model

I'm using Cake 2.0, and getting a database error when I call a particular model.  I think I've probably named something wrongly, but I can't see what!

I have the following:

DB table: confcommittees

Model/Confcommittee.php:
class Confcommittee extends AppModel {
    public $name = 'Confcommittee';

    var $belongsTo = array('Conference');

    public function myFunction() {
        return false;
    }
}

Controller/ConferencesController.php:
App::uses('AppController', 'Controller');
class ConferencesController extends AppController {
public $name = 'Conferences';
public $helpers = array('Html', 'Session');
public $uses = array('Conference', 'Confcommittee');

/* Filters and callbacks */
function beforeFilter() {
parent::beforeFilter();
}
/*
* admin_manage
* Allows the admin user to manage any given conference
*/
function admin_manage($conference_id = null) {
if(!$conference_id) {
$this->redirect('/admin/conferences/main');
exit;
}
$this->Confcommittee->myFunction();
        }
}
When I access admin/conferences/manage, I get the following error:
Database Error
Error: SQLSTATE[42000]: Syntax error or access violation: 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 'myFunction' at line 1
SQL Query: myFunction
Notice: If you want to customize this error message, create app\View\Errors\pdo_error.ctp
Stack Trace

As I said, I think I've given something the wrong name, but I can't find it.  Can anyone help?! 

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
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

No comments: