Re: Getting DB error on calling Model

2012-08-02 Thread lowpass
If you have caching enabled be sure to clear the tmp/cache/models dir.

On Thu, Aug 2, 2012 at 9:24 AM, WhyNotSmile  wrote:
> Hmmm... I removed the Conference association and it's still not working.
> I've decided to give up on that bit and just put the function into the
> controller for now, and that seems to be working fine.
>
> Thanks for the help though.
>
>
>
> On Thursday, 2 August 2012 12:44:07 UTC+1, majna wrote:
>>
>> Yeah, changing order affects only 1.3 apps as 2.x models are lazy loaded.
>> I tested that code you pasted and Confcommittee::myFunction() (without
>> belongsTo association to Conference) works just fine.
>>
>> What code do you have in AppController::beforeFilter()?
>>
>> On Thursday, August 2, 2012 12:13:37 PM UTC+2, WhyNotSmile wrote:
>>>
>>> Hi manja, thanks for your help, but it's not inside a plugin, and
>>> changing the order didn't make any difference.
>>>
>>>
>>>
>>> On Wednesday, 1 August 2012 21:41:12 UTC+1, majna wrote:

 If it's not the plugin issue, then Conference model is associated with
 Confcommittee with wrong 'class' name.
 You can test that if you change order in $uses:
 public $uses = array('Confcommittee', 'Conference');

 On Wednesday, August 1, 2012 10:35:12 PM UTC+2, majna wrote:
>
> Is this code inside a plugin?
>
> 2012/8/1 WhyNotSmile
>>
>> Thanks for the help, but it hasn't made any difference.  I'm totally
>> baffled, because I've used the same code in other places with different
>> model names, and it seems fine... I must have just missed something on
>> copying it.
>>
>>
>>
>> On Wednesday, 1 August 2012 20:58:42 UTC+1, majna wrote:
>>>
>>> Model Confcommittee is not found, so Cake creates an instance of
>>> AppModel.
>>> You are using $uses property, so try to add in
>>> Model/Confcommittee.php:
>>>
>>> App::uses('Confcommittee ', 'Model');
>>>
>>> class Confcommittee extends AppModel { ...
>>>
>>> Btw, you don't need to call exit() after redirect() in that
>>> controller.
>>>
>>>
>>> On Wednesday, August 1, 2012 5:44:18 PM UTC+2, WhyNotSmile wrote:

 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
>
> CORE\Cake\Model\Datasource\DboSource.php line 437
>  → PDOStatement->execute(array)
>
> CORE\Cake\Model\Datasource\DboSource.php line 403
>  → DboSource->_execute(string, array)
>
> CORE\Cake\Model\Datasource\DboSource.php line 647
>  → DboSource->execute(string, array, array)
>
> CORE\Cake\Model\Datasource\DboSource.php line 589
>  → DboSource->fetchAll(string, array, array)
>
> CORE\Cake\Model\Model.php line 775
>  → DboSource->query(string, array, AppModel)
>
> APP\Controller\ConferencesController.php line 96
>  → Model->__call(string, array)
>
> APP\Controller\ConferencesController.php line 96
>  → AppModel->myFunction()
>
>>

Re: Getting DB error on calling Model

2012-08-02 Thread WhyNotSmile
Hmmm... I removed the Conference association and it's still not working. 
 I've decided to give up on that bit and just put the function into the 
controller for now, and that seems to be working fine.

Thanks for the help though.



On Thursday, 2 August 2012 12:44:07 UTC+1, majna wrote:
>
> Yeah, changing order affects only 1.3 apps as 2.x models are lazy loaded.
> I tested that code you pasted and Confcommittee::myFunction() (without 
> belongsTo association to Conference) works just fine.
>
> What code do you have in AppController::beforeFilter()?
>  
> On Thursday, August 2, 2012 12:13:37 PM UTC+2, WhyNotSmile wrote:
>>
>> Hi manja, thanks for your help, but it's not inside a plugin, and 
>> changing the order didn't make any difference.
>>
>>
>>
>> On Wednesday, 1 August 2012 21:41:12 UTC+1, majna wrote:
>>>
>>> If it's not the plugin issue, then Conference model is associated with 
>>> Confcommittee with wrong 'class' name.
>>> You can test that if you change order in $uses:
>>> public $uses = array('Confcommittee', 'Conference');
>>>
>>> On Wednesday, August 1, 2012 10:35:12 PM UTC+2, majna wrote:

 Is this code inside a plugin?

 2012/8/1 WhyNotSmile

> Thanks for the help, but it hasn't made any difference.  I'm totally 
> baffled, because I've used the same code in other places with different 
> model names, and it seems fine... I must have just missed something on 
> copying it.
>
>
>
> On Wednesday, 1 August 2012 20:58:42 UTC+1, majna wrote:
>>
>> Model Confcommittee is not found, so Cake creates an instance of 
>> AppModel.
>> You are using $uses property, so try to add in 
>> Model/Confcommittee.php:
>>
>> App::uses('Confcommittee ', 'Model');
>>
>> class Confcommittee extends AppModel { ...
>>
>> Btw, you don't need to call exit() after redirect() in that 
>> controller.
>>
>>
>> On Wednesday, August 1, 2012 5:44:18 PM UTC+2, WhyNotSmile wrote:
>>>
>>> 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

- CORE\Cake\Model\Datasource\**DboSource.php line 
 437 
 → 
 PDOStatement->execute(**array)


- CORE\Cake\Model\Datasource\**DboSource.php line 
 403 
 → DboSource->_execute(string, 
 array)


- CORE\Cake\Model\Datasource\**DboSource.php line 
 647 
 → DboSource->execute(string, array, 
 array)


- CORE\Cake\Model\Datasource\**DboSource.php line 
 589 
 → DboSource->fetchAll(string, array, 
 array)

Re: Getting DB error on calling Model

2012-08-02 Thread majna
Yeah, changing order affects only 1.3 apps as 2.x models are lazy loaded.
I tested that code you pasted and Confcommittee::myFunction() (without 
belongsTo association to Conference) works just fine.

What code do you have in AppController::beforeFilter()?
 
On Thursday, August 2, 2012 12:13:37 PM UTC+2, WhyNotSmile wrote:
>
> Hi manja, thanks for your help, but it's not inside a plugin, and changing 
> the order didn't make any difference.
>
>
>
> On Wednesday, 1 August 2012 21:41:12 UTC+1, majna wrote:
>>
>> If it's not the plugin issue, then Conference model is associated with 
>> Confcommittee with wrong 'class' name.
>> You can test that if you change order in $uses:
>> public $uses = array('Confcommittee', 'Conference');
>>
>> On Wednesday, August 1, 2012 10:35:12 PM UTC+2, majna wrote:
>>>
>>> Is this code inside a plugin?
>>>
>>> 2012/8/1 WhyNotSmile
>>>
 Thanks for the help, but it hasn't made any difference.  I'm totally 
 baffled, because I've used the same code in other places with different 
 model names, and it seems fine... I must have just missed something on 
 copying it.



 On Wednesday, 1 August 2012 20:58:42 UTC+1, majna wrote:
>
> Model Confcommittee is not found, so Cake creates an instance of 
> AppModel.
> You are using $uses property, so try to add in Model/Confcommittee.php:
>
> App::uses('Confcommittee ', 'Model');
>
> class Confcommittee extends AppModel { ...
>
> Btw, you don't need to call exit() after redirect() in that controller.
>
>
> On Wednesday, August 1, 2012 5:44:18 PM UTC+2, WhyNotSmile wrote:
>>
>> 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
>>>
>>>- CORE\Cake\Model\Datasource\**DboSource.php line 
>>> 437 
>>> → 
>>> PDOStatement->execute(**array)
>>>
>>>
>>>- CORE\Cake\Model\Datasource\**DboSource.php line 
>>> 403 
>>> → DboSource->_execute(string, 
>>> array)
>>>
>>>
>>>- CORE\Cake\Model\Datasource\**DboSource.php line 
>>> 647 
>>> → DboSource->execute(string, array, 
>>> array)
>>>
>>>
>>>- CORE\Cake\Model\Datasource\**DboSource.php line 
>>> 589 
>>> → DboSource->fetchAll(string, array, 
>>> array)
>>>
>>>
>>>- CORE\Cake\Model\Model.php line 
>>> 775 
>>> → DboSource->query(string, array, 
>>> AppModel)
>>>
>>>
>>>- APP\Controller\**ConferencesController.php line 
>>> 96 

Re: Getting DB error on calling Model

2012-08-02 Thread WhyNotSmile
Thanks for your help, but I checked and the associated column is definitely 
there and seems correct.



On Thursday, 2 August 2012 07:24:50 UTC+1, Saran Pal wrote:
>
> Hi,
>
> You are using  var $belongsTo = array('Conference') for association the 
> table so when it create the it find the associated column and i think this 
> is not exist so it will say SQL error.
>
> you should create associate colunm in teh table.
>
> Cheers...
>
> Saran Pal
>
>
> On Thu, Aug 2, 2012 at 2:11 AM, majna wrote:
>
>> If it's not the plugin issue, then Conference model is associated with 
>> Confcommittee with wrong 'class' name.
>> You can test that if you change order in $uses:
>> public $uses = array('Confcommittee', 'Conference');
>>
>>
>> On Wednesday, August 1, 2012 10:35:12 PM UTC+2, majna wrote:
>>>
>>> Is this code inside a plugin?
>>>
>>> 2012/8/1 WhyNotSmile 
>>>
 Thanks for the help, but it hasn't made any difference.  I'm totally 
 baffled, because I've used the same code in other places with different 
 model names, and it seems fine... I must have just missed something on 
 copying it.



 On Wednesday, 1 August 2012 20:58:42 UTC+1, majna wrote:
>
> Model Confcommittee is not found, so Cake creates an instance of 
> AppModel.
> You are using $uses property, so try to add in Model/Confcommittee.php:
>
> App::uses('Confcommittee ', 'Model');
>
> class Confcommittee extends AppModel { ...
>
> Btw, you don't need to call exit() after redirect() in that controller.
>
>
> On Wednesday, August 1, 2012 5:44:18 PM UTC+2, WhyNotSmile wrote:
>>
>> 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/**confer**ences/main');
>>> exit;
>>>  }
>>> $this->Confcommittee->**myFuncti**on();
>>> }
>>> }
>>>
>>> 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
>>>
>>>- CORE\Cake\Model\Datasource\**Dbo**Source.php line 
>>> 437 
>>> → 
>>> PDOStatement->execute(**array**)
>>>
>>>
>>>- CORE\Cake\Model\Datasource\**Dbo**Source.php line 
>>> 403 
>>> → DboSource->_execute(string, 
>>> array)
>>>
>>>
>>>- CORE\Cake\Model\Datasource\**Dbo**Source.php line 
>>> 647 
>>> → DboSource->execute(string, array, 
>>> array)
>>>
>>>
>>>- CORE\Cake\Model\Datasource\**Dbo**Source.php line 
>>> 589 
>>> → DboSource->fetchAll(string, array, 
>>> array)
>>>
>>>
>>>- CORE\Cake\Model\Model.php line 
>>> 775 
>>> → DboSource->query(string, array, 
>>> AppModel)
>>>
>>>
>>>- APP\Controller\**ConferencesCont**roller.php line 
>>> 96

Re: Getting DB error on calling Model

2012-08-02 Thread WhyNotSmile
Hi manja, thanks for your help, but it's not inside a plugin, and changing 
the order didn't make any difference.



On Wednesday, 1 August 2012 21:41:12 UTC+1, majna wrote:
>
> If it's not the plugin issue, then Conference model is associated with 
> Confcommittee with wrong 'class' name.
> You can test that if you change order in $uses:
> public $uses = array('Confcommittee', 'Conference');
>
> On Wednesday, August 1, 2012 10:35:12 PM UTC+2, majna wrote:
>>
>> Is this code inside a plugin?
>>
>> 2012/8/1 WhyNotSmile
>>
>>> Thanks for the help, but it hasn't made any difference.  I'm totally 
>>> baffled, because I've used the same code in other places with different 
>>> model names, and it seems fine... I must have just missed something on 
>>> copying it.
>>>
>>>
>>>
>>> On Wednesday, 1 August 2012 20:58:42 UTC+1, majna wrote:

 Model Confcommittee is not found, so Cake creates an instance of 
 AppModel.
 You are using $uses property, so try to add in Model/Confcommittee.php:

 App::uses('Confcommittee ', 'Model');

 class Confcommittee extends AppModel { ...

 Btw, you don't need to call exit() after redirect() in that controller.


 On Wednesday, August 1, 2012 5:44:18 PM UTC+2, WhyNotSmile wrote:
>
> 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
>>
>>- CORE\Cake\Model\Datasource\**DboSource.php line 
>> 437 
>> → 
>> PDOStatement->execute(**array)
>>
>>
>>- CORE\Cake\Model\Datasource\**DboSource.php line 
>> 403 
>> → DboSource->_execute(string, 
>> array)
>>
>>
>>- CORE\Cake\Model\Datasource\**DboSource.php line 
>> 647 
>> → DboSource->execute(string, array, 
>> array)
>>
>>
>>- CORE\Cake\Model\Datasource\**DboSource.php line 
>> 589 
>> → DboSource->fetchAll(string, array, 
>> array)
>>
>>
>>- CORE\Cake\Model\Model.php line 
>> 775 
>> → DboSource->query(string, array, 
>> AppModel)
>>
>>
>>- APP\Controller\**ConferencesController.php line 
>> 96 
>> → Model->__call(string, 
>> array)
>>
>>
>>- APP\Controller\**ConferencesController.php line 
>> 96 
>> → 
>> AppModel->myFunction()
>>
>>
>>- [internal 
>> function] 
>> → 
>

Re: Getting DB error on calling Model

2012-08-01 Thread Saran Pal
Hi,

You are using  var $belongsTo = array('Conference') for association the
table so when it create the it find the associated column and i think this
is not exist so it will say SQL error.

you should create associate colunm in teh table.

Cheers...

Saran Pal


On Thu, Aug 2, 2012 at 2:11 AM, majna  wrote:

> If it's not the plugin issue, then Conference model is associated with
> Confcommittee with wrong 'class' name.
> You can test that if you change order in $uses:
> public $uses = array('Confcommittee', 'Conference');
>
>
> On Wednesday, August 1, 2012 10:35:12 PM UTC+2, majna wrote:
>>
>> Is this code inside a plugin?
>>
>> 2012/8/1 WhyNotSmile 
>>
>>> Thanks for the help, but it hasn't made any difference.  I'm totally
>>> baffled, because I've used the same code in other places with different
>>> model names, and it seems fine... I must have just missed something on
>>> copying it.
>>>
>>>
>>>
>>> On Wednesday, 1 August 2012 20:58:42 UTC+1, majna wrote:

 Model Confcommittee is not found, so Cake creates an instance of
 AppModel.
 You are using $uses property, so try to add in Model/Confcommittee.php:

 App::uses('Confcommittee ', 'Model');

 class Confcommittee extends AppModel { ...

 Btw, you don't need to call exit() after redirect() in that controller.


 On Wednesday, August 1, 2012 5:44:18 PM UTC+2, WhyNotSmile wrote:
>
> 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/**confer**ences/main');
>> exit;
>>  }
>> $this->Confcommittee->**myFuncti**on();
>> }
>> }
>>
>> 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
>>
>>- CORE\Cake\Model\Datasource\**Dbo**Source.php line 
>> 437
>> → 
>> PDOStatement->execute(**array**)
>>
>>
>>- CORE\Cake\Model\Datasource\**Dbo**Source.php line 
>> 403
>> → DboSource->_execute(string, 
>> array)
>>
>>
>>- CORE\Cake\Model\Datasource\**Dbo**Source.php line 
>> 647
>> → DboSource->execute(string, array, 
>> array)
>>
>>
>>- CORE\Cake\Model\Datasource\**Dbo**Source.php line 
>> 589
>> → DboSource->fetchAll(string, array, 
>> array)
>>
>>
>>- CORE\Cake\Model\Model.php line 
>> 775
>> → DboSource->query(string, array, 
>> AppModel)
>>
>>
>>- APP\Controller\**ConferencesCont**roller.php line 
>> 96
>> → Model->__call(string, 
>> array)
>>
>>
>>- APP\Controller\**ConferencesCont**roller.php line 
>> 96
>> → 
>> AppModel->myFunction()

Re: Getting DB error on calling Model

2012-08-01 Thread majna
If it's not the plugin issue, then Conference model is associated with 
Confcommittee with wrong 'class' name.
You can test that if you change order in $uses:
public $uses = array('Confcommittee', 'Conference');

On Wednesday, August 1, 2012 10:35:12 PM UTC+2, majna wrote:
>
> Is this code inside a plugin?
>
> 2012/8/1 WhyNotSmile 
>
>> Thanks for the help, but it hasn't made any difference.  I'm totally 
>> baffled, because I've used the same code in other places with different 
>> model names, and it seems fine... I must have just missed something on 
>> copying it.
>>
>>
>>
>> On Wednesday, 1 August 2012 20:58:42 UTC+1, majna wrote:
>>>
>>> Model Confcommittee is not found, so Cake creates an instance of 
>>> AppModel.
>>> You are using $uses property, so try to add in Model/Confcommittee.php:
>>>
>>> App::uses('Confcommittee ', 'Model');
>>>
>>> class Confcommittee extends AppModel { ...
>>>
>>> Btw, you don't need to call exit() after redirect() in that controller.
>>>
>>>
>>> On Wednesday, August 1, 2012 5:44:18 PM UTC+2, WhyNotSmile wrote:

 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
>
>- CORE\Cake\Model\Datasource\**DboSource.php line 
> 437 
> → 
> PDOStatement->execute(**array)
>
>
>- CORE\Cake\Model\Datasource\**DboSource.php line 
> 403 
> → DboSource->_execute(string, 
> array)
>
>
>- CORE\Cake\Model\Datasource\**DboSource.php line 
> 647 
> → DboSource->execute(string, array, 
> array)
>
>
>- CORE\Cake\Model\Datasource\**DboSource.php line 
> 589 
> → DboSource->fetchAll(string, array, 
> array)
>
>
>- CORE\Cake\Model\Model.php line 
> 775 
> → DboSource->query(string, array, 
> AppModel)
>
>
>- APP\Controller\**ConferencesController.php line 
> 96 
> → Model->__call(string, 
> array)
>
>
>- APP\Controller\**ConferencesController.php line 
> 96 
> → 
> AppModel->myFunction()
>
>
>- [internal 
> function] 
> → 
> ConferencesController->**admin_manage(string)
>
>
>- CORE\Cake\Controller\**Controller.php line 
> 485
> → ReflectionMethod->**invokeArgs(**ConferencesController, 
> array

Re: Getting DB error on calling Model

2012-08-01 Thread majna
Is this code inside a plugin?

2012/8/1 WhyNotSmile 

> Thanks for the help, but it hasn't made any difference.  I'm totally
> baffled, because I've used the same code in other places with different
> model names, and it seems fine... I must have just missed something on
> copying it.
>
>
>
> On Wednesday, 1 August 2012 20:58:42 UTC+1, majna wrote:
>>
>> Model Confcommittee is not found, so Cake creates an instance of AppModel.
>> You are using $uses property, so try to add in Model/Confcommittee.php:
>>
>> App::uses('Confcommittee ', 'Model');
>>
>> class Confcommittee extends AppModel { ...
>>
>> Btw, you don't need to call exit() after redirect() in that controller.
>>
>>
>> On Wednesday, August 1, 2012 5:44:18 PM UTC+2, WhyNotSmile wrote:
>>>
>>> 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

- CORE\Cake\Model\Datasource\**DboSource.php line 
 437
 → 
 PDOStatement->execute(**array)


- CORE\Cake\Model\Datasource\**DboSource.php line 
 403
 → DboSource->_execute(string, 
 array)


- CORE\Cake\Model\Datasource\**DboSource.php line 
 647
 → DboSource->execute(string, array, 
 array)


- CORE\Cake\Model\Datasource\**DboSource.php line 
 589
 → DboSource->fetchAll(string, array, 
 array)


- CORE\Cake\Model\Model.php line 
 775
 → DboSource->query(string, array, 
 AppModel)


- APP\Controller\**ConferencesController.php line 
 96
 → Model->__call(string, 
 array)


- APP\Controller\**ConferencesController.php line 
 96
 → 
 AppModel->myFunction()


- [internal 
 function]
 → 
 ConferencesController->**admin_manage(string)


- CORE\Cake\Controller\**Controller.php line 
 485
 → ReflectionMethod->**invokeArgs(**ConferencesController, 
 array)


- CORE\Cake\Routing\Dispatcher.**php line 
 103
 → 
 Controller->invokeAction(**CakeRequest)


- CORE\Cake\Routing\Dispatcher.**php line 
 85
 → Dispatcher->_invoke(**Co

Re: Getting DB error on calling Model

2012-08-01 Thread WhyNotSmile
Thanks for the help, but it hasn't made any difference.  I'm totally 
baffled, because I've used the same code in other places with different 
model names, and it seems fine... I must have just missed something on 
copying it.



On Wednesday, 1 August 2012 20:58:42 UTC+1, majna wrote:
>
> Model Confcommittee is not found, so Cake creates an instance of AppModel.
> You are using $uses property, so try to add in Model/Confcommittee.php:
>
> App::uses('Confcommittee ', 'Model');
>
> class Confcommittee extends AppModel { ...
>
> Btw, you don't need to call exit() after redirect() in that controller.
>
>
> On Wednesday, August 1, 2012 5:44:18 PM UTC+2, WhyNotSmile wrote:
>>
>> 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
>>>
>>>- CORE\Cake\Model\Datasource\DboSource.php line 
>>> 437
>>> → 
>>> PDOStatement->execute(array)
>>>
>>>
>>>- CORE\Cake\Model\Datasource\DboSource.php line 
>>> 403
>>> → DboSource->_execute(string, 
>>> array)
>>>
>>>
>>>- CORE\Cake\Model\Datasource\DboSource.php line 
>>> 647
>>> → DboSource->execute(string, array, 
>>> array)
>>>
>>>
>>>- CORE\Cake\Model\Datasource\DboSource.php line 
>>> 589
>>> → DboSource->fetchAll(string, array, 
>>> array)
>>>
>>>
>>>- CORE\Cake\Model\Model.php line 
>>> 775
>>> → DboSource->query(string, array, 
>>> AppModel)
>>>
>>>
>>>- APP\Controller\ConferencesController.php line 
>>> 96
>>> → Model->__call(string, 
>>> array)
>>>
>>>
>>>- APP\Controller\ConferencesController.php line 
>>> 96
>>> → 
>>> AppModel->myFunction()
>>>
>>>
>>>- [internal 
>>> function]
>>> → 
>>> ConferencesController->admin_manage(string)
>>>
>>>
>>>- CORE\Cake\Controller\Controller.php line 
>>> 485
>>> → ReflectionMethod->invokeArgs(ConferencesController, 
>>> array)
>>>
>>>
>>>- CORE\Cake\Routing\Dispatcher.php line 
>>> 103
>>> → 
>>> Controller->invokeAction(CakeRequest)
>>>
>>>
>>>- CORE\Cake\Routing\Dispatcher.php line 
>>> 85
>>> → Dispatcher->_invoke(ConferencesController, CakeRequest, 
>>>CakeResponse) 
>>>
>>>
>>>- APP\webroot\index.php line 
>>> 92
>>> → Dis

Re: Getting DB error on calling Model

2012-08-01 Thread majna
Model Confcommittee is not found, so Cake creates an instance of AppModel.
You are using $uses property, so try to add in Model/Confcommittee.php:

App::uses('Confcommittee ', 'Model');

class Confcommittee extends AppModel { ...

Btw, you don't need to call exit() after redirect() in that controller.


On Wednesday, August 1, 2012 5:44:18 PM UTC+2, WhyNotSmile wrote:
>
> 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
>>
>>- CORE\Cake\Model\Datasource\DboSource.php line 
>> 437
>> → 
>> PDOStatement->execute(array)
>>
>>
>>- CORE\Cake\Model\Datasource\DboSource.php line 
>> 403
>> → DboSource->_execute(string, 
>> array)
>>
>>
>>- CORE\Cake\Model\Datasource\DboSource.php line 
>> 647
>> → DboSource->execute(string, array, 
>> array)
>>
>>
>>- CORE\Cake\Model\Datasource\DboSource.php line 
>> 589
>> → DboSource->fetchAll(string, array, 
>> array)
>>
>>
>>- CORE\Cake\Model\Model.php line 
>> 775
>> → DboSource->query(string, array, 
>> AppModel)
>>
>>
>>- APP\Controller\ConferencesController.php line 
>> 96
>> → Model->__call(string, 
>> array)
>>
>>
>>- APP\Controller\ConferencesController.php line 
>> 96
>> → 
>> AppModel->myFunction()
>>
>>
>>- [internal 
>> function]
>> → 
>> ConferencesController->admin_manage(string)
>>
>>
>>- CORE\Cake\Controller\Controller.php line 
>> 485
>> → ReflectionMethod->invokeArgs(ConferencesController, 
>> array)
>>
>>
>>- CORE\Cake\Routing\Dispatcher.php line 
>> 103
>> → 
>> Controller->invokeAction(CakeRequest)
>>
>>
>>- CORE\Cake\Routing\Dispatcher.php line 
>> 85
>> → Dispatcher->_invoke(ConferencesController, CakeRequest, 
>>CakeResponse) 
>>
>>
>>- APP\webroot\index.php line 
>> 92
>> → Dispatcher->dispatch(CakeRequest, 
>> CakeResponse)
>>
>>
> 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 unsubsc

Re: Getting DB error on calling Model

2012-08-01 Thread lowpass
This is the only thing I can see that looks odd:

> Controller/ConferencesController.php:
>>
>> App::uses('AppController', 'Controller');
>>
>> class ConferencesController extends AppController {

However, adding it to one of my own controllers doesn't seem to do any
harm, so maybe that's not the problem.

The App::uses line is only (sometimes) necessary in AppController, in
which case it looks like this:

App::uses('Controller', 'Controller');
class AppController extends Controller

I say sometimes because I vaguely remember there is some issue which
adding that to AppController resolves, but it's not generally
necessary.

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Getting DB error on calling Model

2012-08-01 Thread WhyNotSmile
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
>
>- CORE\Cake\Model\Datasource\DboSource.php line 
> 437
> → 
> PDOStatement->execute(array)
>
>
>- CORE\Cake\Model\Datasource\DboSource.php line 
> 403
> → DboSource->_execute(string, 
> array)
>
>
>- CORE\Cake\Model\Datasource\DboSource.php line 
> 647
> → DboSource->execute(string, array, 
> array)
>
>
>- CORE\Cake\Model\Datasource\DboSource.php line 
> 589
> → DboSource->fetchAll(string, array, 
> array)
>
>
>- CORE\Cake\Model\Model.php line 
> 775
> → DboSource->query(string, array, 
> AppModel)
>
>
>- APP\Controller\ConferencesController.php line 
> 96
> → Model->__call(string, 
> array)
>
>
>- APP\Controller\ConferencesController.php line 
> 96
> → 
> AppModel->myFunction()
>
>
>- [internal 
> function]
> → 
> ConferencesController->admin_manage(string)
>
>
>- CORE\Cake\Controller\Controller.php line 
> 485
> → ReflectionMethod->invokeArgs(ConferencesController, 
> array)
>
>
>- CORE\Cake\Routing\Dispatcher.php line 
> 103
> → 
> Controller->invokeAction(CakeRequest)
>
>
>- CORE\Cake\Routing\Dispatcher.php line 
> 85
> → Dispatcher->_invoke(ConferencesController, CakeRequest, 
>CakeResponse) 
>
>
>- APP\webroot\index.php line 
> 92
> → Dispatcher->dispatch(CakeRequest, 
> CakeResponse)
>
>
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php