Strange error after model save method
Hello. I was creating an add form for a model called Practitioner. Everything seems to work fine, after submitting the form changes are saved successfully in Practitioner table and in every table related to Practitioner model, but a weird error is showing up that's claiming for a rght field in my Practitioner model, and I don't know what this rght field stands for and it isn't in any of my tables. Any suggestions are greatly appreciated. This is the error I get: Warning (512): SQL Error: 1054: Unknown column 'Practitioner.rght' in 'field list' [CORE/cake/libs/model/datasources/dbo_source.php, line 666] Code | Context $out = null; if ($error) { trigger_error('span style=color:Red;text- align:leftb' . __('SQL Error:', true) . /b {$this-error}/ span, E_USER_WARNING); $sql= SELECT MAX(`Practitioner`.`rght`) AS `rght` FROM `practitioners` AS `Practitioner` WHERE 1 = 1LIMIT 1 $error = 1054: Unknown column 'Practitioner.rght' in 'field list' $out= null DboSource::showQuery() - CORE/cake/libs/model/datasources/ dbo_source.php, line 666 DboSource::execute() - CORE/cake/libs/model/datasources/ dbo_source.php, line 256 DboSource::fetchAll() - CORE/cake/libs/model/datasources/ dbo_source.php, line 400 DboSource::read() - CORE/cake/libs/model/datasources/dbo_source.php, line 805 Model::find() - CORE/cake/libs/model/model.php, line 2093 AppModel::find() - APP/app_model.php, line 40 TreeBehavior::__getMax() - CORE/cake/libs/model/behaviors/tree.php, line 904 TreeBehavior::beforeSave() - CORE/cake/libs/model/behaviors/tree.php, line 157 ModelBehavior::dispatchMethod() - CORE/cake/libs/model/ model_behavior.php, line 169 BehaviorCollection::trigger() - CORE/cake/libs/model/ model_behavior.php, line 494 Model::save() - CORE/cake/libs/model/model.php, line 1284 PractitionersController::admin_add() - APP/controllers/ practitioners_controller.php, line 650 Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 204 Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171 [main] - APP/webroot/index.php, line 83 Query: SELECT MAX(`Practitioner`.`rght`) AS `rght` FROM `practitioners` AS `Practitioner` WHERE 1 = 1 LIMIT 1 Warning (2): array_values() expects parameter 1 to be array, boolean given [CORE/cake/libs/model/behaviors/tree.php, line 904] 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Strange error after model save method
Are you using a custom Join statement in your query, particularly a RIGHT JOIN? On Mon, Jun 7, 2010 at 2:34 PM, Roland Pish rolandp...@gmail.com wrote: Hello. I was creating an add form for a model called Practitioner. Everything seems to work fine, after submitting the form changes are saved successfully in Practitioner table and in every table related to Practitioner model, but a weird error is showing up that's claiming for a rght field in my Practitioner model, and I don't know what this rght field stands for and it isn't in any of my tables. Any suggestions are greatly appreciated. This is the error I get: Warning (512): SQL Error: 1054: Unknown column 'Practitioner.rght' in 'field list' [CORE/cake/libs/model/datasources/dbo_source.php, line 666] Code | Context $out = null; if ($error) { trigger_error('span style=color:Red;text- align:leftb' . __('SQL Error:', true) . /b {$this-error}/ span, E_USER_WARNING); $sql= SELECT MAX(`Practitioner`.`rght`) AS `rght` FROM `practitioners` AS `Practitioner` WHERE 1 = 1LIMIT 1 $error = 1054: Unknown column 'Practitioner.rght' in 'field list' $out= null DboSource::showQuery() - CORE/cake/libs/model/datasources/ dbo_source.php, line 666 DboSource::execute() - CORE/cake/libs/model/datasources/ dbo_source.php, line 256 DboSource::fetchAll() - CORE/cake/libs/model/datasources/ dbo_source.php, line 400 DboSource::read() - CORE/cake/libs/model/datasources/dbo_source.php, line 805 Model::find() - CORE/cake/libs/model/model.php, line 2093 AppModel::find() - APP/app_model.php, line 40 TreeBehavior::__getMax() - CORE/cake/libs/model/behaviors/tree.php, line 904 TreeBehavior::beforeSave() - CORE/cake/libs/model/behaviors/tree.php, line 157 ModelBehavior::dispatchMethod() - CORE/cake/libs/model/ model_behavior.php, line 169 BehaviorCollection::trigger() - CORE/cake/libs/model/ model_behavior.php, line 494 Model::save() - CORE/cake/libs/model/model.php, line 1284 PractitionersController::admin_add() - APP/controllers/ practitioners_controller.php, line 650 Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 204 Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171 [main] - APP/webroot/index.php, line 83 Query: SELECT MAX(`Practitioner`.`rght`) AS `rght` FROM `practitioners` AS `Practitioner` WHERE 1 = 1 LIMIT 1 Warning (2): array_values() expects parameter 1 to be array, boolean given [CORE/cake/libs/model/behaviors/tree.php, line 904] 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+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Strange error after model save method
On Jun 7, 3:20 pm, Ed Propsner crotchf...@gmail.com wrote: Are you using a custom Join statement in your query, particularly a RIGHT JOIN? On Mon, Jun 7, 2010 at 2:34 PM, Roland Pish rolandp...@gmail.com wrote: Hello. I was creating an add form for a model called Practitioner. Everything seems to work fine, after submitting the form changes are saved successfully in Practitioner table and in every table related to Practitioner model, but a weird error is showing up that's claiming for a rght field in my Practitioner model, and I don't know what this rght field stands for and it isn't in any of my tables. Any suggestions are greatly appreciated. This is the error I get: Warning (512): SQL Error: 1054: Unknown column 'Practitioner.rght' in 'field list' [CORE/cake/libs/model/datasources/dbo_source.php, line 666] It looks to me like you have $actsAs = array('Tree') in your model. The rght and lft column names are used for the right left fields when using MPTT ordering. I imagine that TreeBehavior is attempting to order your records but the table doesn't have those columns. http://www.ad7six.com/entries/view/56/Working-with-Tree-data-%28MPTT%29 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Strange error after model save method
Looks like Cricket knows what the deal is. I suggested the custom join because I messed one up once and it ended up looking for a column named 'right'. 8-) On Mon, Jun 7, 2010 at 3:30 PM, cricket zijn.digi...@gmail.com wrote: On Jun 7, 3:20 pm, Ed Propsner crotchf...@gmail.com wrote: Are you using a custom Join statement in your query, particularly a RIGHT JOIN? On Mon, Jun 7, 2010 at 2:34 PM, Roland Pish rolandp...@gmail.com wrote: Hello. I was creating an add form for a model called Practitioner. Everything seems to work fine, after submitting the form changes are saved successfully in Practitioner table and in every table related to Practitioner model, but a weird error is showing up that's claiming for a rght field in my Practitioner model, and I don't know what this rght field stands for and it isn't in any of my tables. Any suggestions are greatly appreciated. This is the error I get: Warning (512): SQL Error: 1054: Unknown column 'Practitioner.rght' in 'field list' [CORE/cake/libs/model/datasources/dbo_source.php, line 666] It looks to me like you have $actsAs = array('Tree') in your model. The rght and lft column names are used for the right left fields when using MPTT ordering. I imagine that TreeBehavior is attempting to order your records but the table doesn't have those columns. http://www.ad7six.com/entries/view/56/Working-with-Tree-data-%28MPTT%29 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+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en