dsgoj7457 2014-09-24 19:02
浏览 69
已采纳

Phalcon PHP:模型验证()函数?

In my model, I'm including the function validation(). It doesn't seem to be getting hit. I have something similar to this:

class People extends Phalcon\Mvc\Model {
    public function validation() {
        die('here');
    }
}

$person = new People();
$person->name = 'Bob';
$person->save();

But the validation function never gets called. Is there something I'm missing?

Thanks!

  • 写回答

1条回答 默认 最新

  • dounao4179 2014-09-25 10:29
    关注

    This method works only for existing model records.
    If you want to validate on create, you could use beforeValidationOnCreate() method.
    You can visit phalcon Documentation for all events.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?