0

複数選択が正しく入力され、正常に保存されていますが、編集時に選択した値が選択されていません。

マイフォーム ->

echo $this->Form->inputs(array(
        ...
        'AnaestheticTechnique',
        ...
    ));

私のHABTM関係

class PatientCase extends AppModel {
    public $hasAndBelongsToMany = array(
            'AnaestheticTechnique' =>
                array(
                    'className'              => 'AnaestheticTechnique',
                    'joinTable'              => 'anaesthetic_techniques_patient_cases',
                    'foreignKey'             => 'patient_case_id',
                    'associationForeignKey'  => 'anaesthetic_technique_id',
                    'unique'                 => true
                ),
    );
}

私のコントローラーで

    $anaestheticTechniques = $this->PatientCase->AnaestheticTechnique->find('list');
    $this->set(compact('anaestheticTechniques'));

選択入力の名前は次のように生成されます

データ[麻酔法][麻酔法][]

ただし、 $this が返されます

$this->data[麻酔法][0][]

これを修正する方法はありますか?

4

0 に答える 0