2
votes

m using cakephp 3.0 and m using bin/cake bake all for baking all views. but m getting error while baking dependent view..like previously i had baked views for products using

bin/cake bake all products

but when i use same for

bin/cake bake all products_mix

m getting following error

Exception: SQLSTATE[42S02]: Base table or view not found: 1146 Table
'cakephp3_s.products_mix' doesn't exist in
[/home/shital/public_html/cakephp3/myCakeApp/vendor/cakephp/cakephp/src/Database/Schema/Collection.php,
line 130] 2015-02-20 06:35:57 Error: [Cake\Database\Exception]
SQLSTATE[42S02]: Base table or view not found: 1146 Table
'cakephp3_s.products_mix' doesn't exist

can anyone please help me for this error.. m not getting actually what mistake m making here???

2

2 Answers

2
votes

When you use cakePHP follow naming conventions or it will simply wont work.

bin/cake bake all products_mix is wrong table name . As you must use plural name for view . Remember in cakephp all names are Plurals exept your model.

I suggest you to use another grammatical proper name for view. Like say product_tags , product_attributes . See if there are multiple words for view , then make last word plural .

In other case if you have HABTM(Has And Belongs To Many) relationship, you should make both words plural. Like users_courses , here it connects to users,courses tables ,and contain Foreign key to those tables. So by naming convention HABTM table has both words pluralized.

Fore conventions in cakePHP ,refer Link.

1
votes

As per CakePHP's conventions all table names should be plural not singular , so that's the first thing you should fix. products_mix in not a proper one.