tags:

views:

298

answers:

3

I developed small CakePHP application, and now I want to add one more table (in fact, model/controller/view) into system, named notes. I had already created a table of course.

But when I run command cake bake model, I do not get table Notes on the list. I can add it manually, but after that I get some errors when running cake bake controller and cake bake view.

Can you give me some clue why I have those problems, and how to add that new model?

A: 

When you say added it manually, do you mean added the note.php model? If not, you may want to try that. Verify that the model name is correct for the following: file name: note.php class name: class Note extends AppModel table name: notes

Also, be sure the notes table has the id column and it is set to primary key.

If this does not push you in the right direction, please post your notes table schema here. Also, have you had success in baking other things in your app? Have you upgraded anything?

cdburgess
i done everything i done before - created proper table, with all proper elements. after that, i run cake bake model, and i get the list of my 15 tables (is there some kind of limit?), and I can create model only manually, but when i try to create controller, i get msg Error: You must have a model for this class to build scaffold methods. Please try again.What I done wrong?
Afaik there is no limit. Can you test it in another db/cakephp instance to test if it is related to the environment or on table naming? Is there any relation on the table Notes ?
snowflake
+1  A: 

I would also check your app/config/database.php to ensure that you are using the correct database configuration. You may well have added the table to a different database perhaps and the bake is picking up the other database. Also, and this may be obvious, but check you are in the right project, it's easy to be in a different folder and not realise, especially if you have lots of projects.

I'm not aware of a limit on the bake listing. I would check your database to make sure the table exists and has some columns. You can always open up the console bake script and check for a limit and increase it if needs be.

DavidYell
db configuration is 100% ok.here is dump of my table:CREATE TABLE `notes` ( `id` int(11) NOT NULL auto_increment, `timeStamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `title` varchar(255) default NULL, `body` text, `dateCreated` datetime default NULL, `dateUpdated` datetime default NULL, `priority` tinyint(1) default NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;so, everything is so simple, but it doesn't works for me..... :-((((
+1  A: 

I found solution!

I had to delete all from cache directory, /app/tmp/cache/models

Now it works! :-)

If you develop with debug 2 in your app/config/core.php then it will refresh the cache every time :)Perhaps consider updating the title of your question with a [solved] or similar so other people can find your solution :D
DavidYell