You can force the table name in 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 (i.e., not composed of multiple columns):
class MeuModel extends AppModel {
public $useTable = 'minha_tabela';
public $primaryKey = 'minha_tabela_id';
}
In relation to columns username
and password
, names can be configured when you include the component Auth
in Controller. For example, to use a field called email
instead of username
:
public $components = array(
'Auth' => array(
'authenticate' => array(
'Form' => array(
'fields' => array('username' => 'email')
)
)
)
);
More details on section of the manual on authentication.
In my case, the PK corresponds to the name of the table + _id, example "usuarios_id", "eventos_id". It has how to circumvent?
– Calebe Oliveira
Yes @Calebeoliveira, see my updated reply with an example.
– bfavaretto