I am making a system, and have a part of it that needed a select
. The names inside the select
are being displayed, but the data stored in the database (mysql) are relative to the 'id' field, and need to be written to the 'name' field of the 'ops' table in the 'operation' field. table 'tabs'.
Relationships:
public $hasMany = array(
'Op' => array(
'className' => 'Op',
'foreignKey' => 'ficha_id',
'dependent' => false,
'conditions' => '',
'fields' => 'operacao',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
public $belongsTo = array(
'Ficha' => array(
'className' => 'Ficha',
'foreignKey' => 'ficha_id',
'conditions' => '',
'fields' => 'operacao',
'order' => ''
I searched and until now I have not found how to change the 'values' generated by CakePHP.
Structure of the tables: tokens: id, official, server_order, operation, start, end, count, ops_id ops: id, name, acronym, ficha_id, operation (the 'operation' field in 'ops' had to be created based on the relationship between the tables).