You can force the table name into the model definition:
class MeuModel extends AppModel {
public $useTable = 'minha_tabela';
}
Columns can have the name you want, and it is recommended that the table has a PK with autoincrement called id
. If your PK has another name, you can force one, but it needs to be a simple PK (ie, not multiple columns):
class MeuModel extends AppModel {
public $useTable = 'minha_tabela';
public $primaryKey = 'minha_tabela_id';
}
For the username
and password
columns, names can be set when you include the Auth
component on the Controller. For example, to use a field named email
instead of username
:
public $components = array(
'Auth' => array(
'authenticate' => array(
'Form' => array(
'fields' => array('username' => 'email')
)
)
)
);
More details on the Authentication Handbook section .