0
HABTM + cakephp에 문제가 있습니다.HABTM 메인 모델이 saveall()로 저장되었습니다.
public $hasAndBelongsToMany = array(
'Cliente' => array(
'className' => 'Cliente',
'joinTable' => 'tipos_comercio_cliente',
'foreignKey' => 'tipo_comercio',
'associationForeignKey' => 'cliente'
)
);
양식이 게시되면, 내가 배열 $this->request->data
에 있습니다
Cliente :
public $hasAndBelongsToMany = array(
'TiposComercio' => array(
'className' => 'TiposComercio',
'joinTable' => 'tipos_comercio_cliente',
'foreignKey' => 'cliente',
'associationForeignKey' => 'tipo_comercio'
)
);
TiposComercio 내 응용 프로그램에서
난 (관계 정의와 함께)이 모델을 가지고 이 :
array(
'Cliente' => array(
'password' => '*****',
'razao_social' => 'Teste',
'responsavel' => 'responsavel',
'cidade' => '1',
'cep' => '13560201',
'logradouro' => 'Log test',
'numero' => '',
'bairro' => '',
'complemento' => '',
'atividades' => '',
'username' => 'username11',
'TiposComercio' => array(
(int) 0 => '1',
(int) 1 => '4'
)
)
)
$ this-> Cliente-> saveAll ($ this-> request-> data)을 실행할 때; ClientesController에서 다음과 같은 문제가 있습니다 :
- 클라이언트 데이터가 저장됩니다. TiposComercio의 아무 것도 저장되지 않습니다.
무엇이 잘못 되었습니까?
감사합니다.
감사합니다 많이! 오류 수정 방법을 알려주세요! – matheusvmbruno