1
I’m making a system, and there’s a part of it that needed a select
. The names inside the select
are being displayed, but the data saved in the database (mysql) is relative to the 'id' field, and need to be saved from the 'name' field of the ops table in the 'operation' field of the chips table'.
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’ve searched and so far I haven’t found how to change the values generated by Cakephp.
Structure of the tables: tokens: id, function, ordem_service, operation, start, end, count, ops_id ops: id, name, acronym, filename, operation ('operation' field in 'ops' had to be created depending on the relation between tables).
Reading the documentation I believe this can be done: $options = array("one" => 'one', "two" => 'two); $this->Form->select('Model.field', $options));
– Diego Vieira