Error Missing Database Table Cakephp
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Missing database table - CakePHP up vote 0 down vote favorite I have a CakePHP project having 3 plugins: plugin1, plugin2, plugin3. These are simple plugins, I've just tried to split up my project into 3 smaller & easier parts. Plugin1 has to use a model "Model1", where there is no db table for this table. And Cake is showing error : "Missing Database Table Error: Table models1 for model Model1 was not found in datasource default." Here, table-name and Model-name are in correct convention. I don't want to create a table for this, since I don't need it. What to do now ? php mysql database cakephp database-table share|improve this question asked Nov 9 '13 at 18:08 user2973545 12 I've had this same problem when I wasn't loading the model for the plugin correctly. Make sure you use $uses = array('plugin1.Model1') when loading the model in your controller, or else, it'll look in the main application, not find it, then try using a default model, which requires a table with matching name. –Kai Nov 9 '13 at 18:35 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote You can set that model is without table by setting $useTable in the model (from CakeBook) class Example extends AppModel { public $useTable = false; // This model does not use a database table } share|improve this answer answered Nov 9 '13 at 23:18 Nik Chankov 5,6891328 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Ema
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up cakephp: missing database table blog example up vote 0 down http://stackoverflow.com/questions/19880308/missing-database-table-cakephp vote favorite Just started with Cake PHP. I am following the book that is provided on the official website. For the first blog example, I did create the controller, the model and the view, i.e. PostsController.php , Post.php and index.ctp. LearnCake\app\Controller\PostsController.php set('posts', $this->Post->find('all')); } } ?> LearnCake\app\View\Posts\index.ctp
Blog posts
Id | Title | Created |
---|---|---|
Html->link($post[’Post’][’title’], array(’controller’ => ’posts’, ’action’ => ’view’, $post[’Post’][’id’])); ?> |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this http://stackoverflow.com/questions/11434810/missing-database-table-in-cakephp-ive-followed-the-conventions-and-tried-every site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Missing database error missing table in CakePHP, I've followed the conventions and tried everything up vote 1 down vote favorite My app works with other models, but for some reason the "Vote" model cannot connect to the db table when I try to save to it. I've been at this for a couple days and I feel like I've tried everything! here is my controller VoteController.php that calls error missing database the model (edited down for readability): autoRender = false; $User = $this->auth(); if ($User) { $track_id = @$this->params['id']; $this->Vote->upvote($track_id, $User['User']['id']); } } } ?> here is the model vote.php: array( 'u_id' => $user_id, 't_id' => $id, 'upvote' => 1, 'downvote' => 0 )); $this->save($VoteObject); } } ?> And of course, in my database, I have a table "votes" with columns id, u_id, t_id, upvote, and downvote. After everything executes, I get this error: Missing Database Table Error: Table votes for model Vote was not found in datasource default. I've tried deleting the files in tmp, as well as renaming everything, printing out queries, etc, and I can't seem to get anywhere. Any help would be greatly appreciated! php database cakephp model share|improve this question asked Jul 11 '12 at 14:25 The Puma 5101719 3 double check you've deleted all the cached files in APP/tmp; and double check your votes table is in the same da