我正在尝试在控制器中创建验证,以在关系表中检查他们发送账单的人的用户名,并且在站点将发票保存在数据库中之前,姓名是否存在于活动字段中
关系表是id, partyone, partytwo, active, expirydate
. 验证抛出此错误解析错误:语法错误,意外的 T_OBJECT_OPERATOR
public function add(){
if($this->request->is('post')){
$this->Invoice->set($this->request->data);
if(this->Invoice->validates(array('fieldList'=>array('Relationship.partyone','Relationship.active')){
$this->Invoice->create();
if ($this->Invoice->saveAll($this->request->data,array('validate'=>false)))
{
$this->Session->setFlash('The invoice has been saved');
} else {
$this->Session->setFlash('The invoice could not be saved. Please, try again.');
$errors=$this->Invoice->validationErrors;
}
}
}