yep - I applied a hack. see my ticket for details: http://cakephp.lighthouseapp.com/projects/42648/tickets/2277-caketestmodels-in-test-cases-do-not-set-model-tableprefix and http://cakephp.lighthouseapp.com/projects/42648/tickets/2206
or simply use the file from my current cake rep: https://github.com/dereuromark/cakephp/blob/2.0hacked/lib/Cake/Model/Model.php#L705 On 1 Dez., 12:15, Mattia Manzati <manzat...@gmail.com> wrote: > I have the same problem on Cake 2.0.4. Any way to solve? > > On 31 Ott, 17:27, euromark <dereurom...@googlemail.com> wrote: > > > > > > > > > OK... it happens on normal views as well > > just a simple find(first) with 2 contained hasMany relations > > > same problem > > even worse - it has nothing to do with the cache here (cache > > deactivated) > > joins seem to kill the site_ prefix! > > this is quite a problem since the whole application seems to be pretty > > non-functional now > > > On 31 Okt., 14:37, euromark <dereurom...@googlemail.com> wrote: > > > > 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php