catchable fatal error: argument 1 passed to phalcon\mvc\model::validate() must implement interface phalcon\validationinterface, instance of phalcon\mvc\model\validator\presenceof given in c:\wamp\www\test\apps\models\robots.php on line 49
model中的验证代码
use phalcon\mvc\model\validator\presenceof;use phalcon\mvc\model\validator\uniqueness;public function validation() { $this->validate( new presenceof( array( field => name, message => self::name_not_empty ) ) ); $this->validate( new uniqueness( array( 'field' => 'code', 'message' => self::err_code_not_unid ) ) ); if ($this->validationhasfailed() == true) { return false; } return true; }
回复内容: 报错信息
catchable fatal error: argument 1 passed to phalcon\mvc\model::validate() must implement interface phalcon\validationinterface, instance of phalcon\mvc\model\validator\presenceof given in c:\wamp\www\test\apps\models\robots.php on line 49
model中的验证代码
use phalcon\mvc\model\validator\presenceof;use phalcon\mvc\model\validator\uniqueness;public function validation() { $this->validate( new presenceof( array( field => name, message => self::name_not_empty ) ) ); $this->validate( new uniqueness( array( 'field' => 'code', 'message' => self::err_code_not_unid ) ) ); if ($this->validationhasfailed() == true) { return false; } return true; }
