I tried to bake my MVC in cakephp 3. I used Migrations to create my table including the foreign keys. Here's the code I use for migrations
{
$utTable = $this->table('unit_types');
$utTable
->addColumn('unit_type_desc','string')
->addColumn('created','datetime')
->addColumn('modified','datetime')
->create();
$mlTable = $this->table('master_lists');
$mlTable
->addColumn('unit_type_id','integer')
->addForeignKey('unit_type_id', 'unit_types', 'id')
->addColumn('created','datetime')
->addColumn('modified','datetime')
->create();
}
It prompts no error and seems to work well. but when I bake the master lists I got some errors, I saw '0 columns' phrase or something like that and a few more.
Now my question is, is this the proper way to put data association in cakephp? or should I be using my model files? I have no idea. I'm new to this framework. Thanks for any answers.