Create models with Already created database NO CONVENTIONS

Hello everyone, i just started in cake, so i have a database from another app and i want to use it with cake, i tried to create the model or controllers by the BAKE command, but i cant because my DB isnt with the convention and i cant change the DB, what can i do??

You have to do it manually. See Help command cake bake thread

I would suggest that you should change table names and entity names according to CakePHP conventions. It will save you from tons of trouble.

Oh, thank you, just one thing, i was looking for an example of a model, can post an example of a model?

Perhaps something like this :
public function initialize(array $config)
{
parent::initialize($config);

    $this->table('name_of_the_table');
    $this->displayField('name_of_display_field');
    $this->primaryKey('name_of_primary_key');

}
1 Like