I have created a temporary table using cakephp $this->Model->query() and inserted some records using the same $this->Model->query(). I want to paginate the temporary table. I have loaded the temporary model as follows.
App::import('Model', $tmpModel);
$this->loadModel($tmpModel);
Ref Url:
Create temporary table in CakePHP and load it as a Model
Unfortunately the pagination did not happen and i got the following error.
Database table “table name” for model “model name” was not found. Though the table name and model name were written as per the cakephp convention.
What might be the possible solution for it.
I’m almost certain that you won’t be able to do this using temporary tables. This is because’s Cake’s underlying schema caching uses MySql’s ‘SHOW TABLES‘ which doesn’t return temporary tables – hence the reason you’ll always get the “Database table “table name” for model “model name” was not found”
My suggestion therefore would be to create a standard table and then drop it once you’re finished. Here is a example that could be call from a ‘Users‘ controller: