0
게스트 및 자산이라는 두 가지 모델이 있습니다. 자산 belongsTo 손님. 제출시 saveAll()을 사용하여 a) 게스트 테이블 항목을 만들고 b) 자산 정보를 만듭니다. 이 잘 작동하지만, 나는 나가 시려면().saveAll() 모델에 belongsTo 키를 추가하지 않음
어떤 조언을?
// Asset model belongsTo:
public $belongsTo = array(
'User' => array('className' => 'User'),
'AssetType' => array('className' => 'AssetType'),
'Status' => array('className' => 'Status'),
'Guest' => array('className' => 'Guest')
);
// Controller:
public function index() {
pr($this->request->data);
if($this->request->is("post")) {
if($this->Asset->saveAll($this->request->data)) {
$this->Session->setFlash("A new asset has been loaded");
}
}
$assetTypes = $this->Asset->AssetType->find('list');
$this->set("assetTypes", $assetTypes);
}
있다? – thecodeparadox