【发布时间】:2012-01-29 05:51:16
【问题描述】:
我有一个客户 ID 和一个唯一客户哈希。当我注册这些数据时,它工作正常。 为了清楚起见,我不生成哈希。
我用来验证唯一哈希是否已经存在的代码:
protected function _getValidator($field)
{
return array(
'Db_NoRecordExists',
true,
array(
'table' => 'anunciantes',
'field' => $field,
'messages' => array(
'recordFound' => ucfirst($field) . ' "%value%" is registered'
)
)
);
}
但是当我必须编辑该客户端时,我想验证该哈希是否已经存在,以及该哈希是否属于该客户端。
我是怎么做到的?我已经尝试通过使用 db 验证器的 'exclude' 选项并传递 $this->getValue('id') 来获取 id 的值,但该调用返回 null。
【问题讨论】:
标签: php oop zend-framework zend-form zend-validate