any one else having trouble with table prefixes in 2.0?
if the model cache is renewed everything is fine
but as soon as cake uses the model cache the table prefix is lost and
causes sql errors
the prefix is "site_"
query with cached data from /tmp/cache/models:
Error: SQLSTATE[42S02]: Base table or view not found: 1146 Table
'cake.addresses' doesn't exist
SQL Query: SELECT `Address`.`id`, `Address`.`foreign_id`,
`Address`.`model`, `Address`.`country_id`, `Address`.`first_name`,
`Address`.`last_name`, `Address`.`street`, `Address`.`postal_code`,
`Address`.`city`, `Address`.`lat`, `Address`.`lng`,
`Address`.`last_used`, `Address`.`formatted_address`,
`Address`.`type_id`, `Address`.`created`, `Address`.`modified` FROM
`addresses` AS `Address` WHERE `Address`.`foreign_id` = 4 AND
`Address`.`model` = 'Restaurant'
Notice: If you want to customize this error message, create site/View/
Errors/pdo_error.ctp
Stack Trace
#0 /srv/www/.../trunk/lib/Cake/Model/Datasource/DboSource.php(436):
PDOStatement->execute(Array)
#1 /srv/www/.../trunk/lib/Cake/Model/Datasource/DboSource.php(403):
DboSource->_execute('SELECT `Address...', Array)
#2 /srv/www/.../trunk/lib/Cake/Model/Datasource/DboSource.php(645):
DboSource->execute('SELECT `Address...', Array, Array)
#3 /srv/www/.../trunk/lib/Cake/Model/Datasource/DboSource.php(1205):
DboSource->fetchAll('SELECT `Address...', false)
#4 /srv/www/.../trunk/lib/Cake/Model/Datasource/DboSource.php(1226):
DboSource->queryAssociation(Object(Restaurant), Object(Address),
'hasOne', 'Address', Array, Array, true, Array, 0, Array)
#5 /srv/www/.../trunk/lib/Cake/Model/Datasource/DboSource.php(1065):
DboSource->queryAssociation(Object(Coupon), Object(Restaurant),
'belongsTo', 'Restaurant', Array, Array, true, Array, 1, Array)
#6 /srv/www/.../trunk/lib/Cake/Model/Model.php(2458): DboSource-
>read(Object(Coupon), Array)
#7 /srv/www/.../trunk/site/Plugin/Tools/Lib/MyModel.php(417): Model-
>find('all', Array, NULL, NULL)
#8 /srv/www/.../trunk/site/Controller/CouponsController.php(470):
MyModel->find('all', Array)
#9 [internal function]: CouponsController->homepage()
#10 /srv/www/.../trunk/lib/Cake/Controller/Controller.php(473):
ReflectionMethod->invokeArgs(Object(CouponsController), Array)
#11 /srv/www/.../trunk/lib/Cake/Routing/Dispatcher.php(107):
Controller->invokeAction(Object(CakeRequest))
#12 /srv/www/.../trunk/lib/Cake/Routing/Dispatcher.php(89): Dispatcher-
>_invoke(Object(CouponsController), Object(CakeRequest),
Object(CakeResponse))
#13 /srv/www/.../trunk/site/webroot/index.php(96): Dispatcher-
>dispatch(Object(CakeRequest), Object(CakeResponse))
#14 {main}
it should have been
"FROM `site_addresses` AS `Address`"
--
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
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home