Mvc\Collection::appendMessage

public appendMessage (Phalcon\Mvc\Model\MessageInterface $message)

Appends a customized message on the validation process

use \Phalcon\Mvc\Model\Message as Message;

class Robots extends \Phalcon\Mvc\Model
{

    public function beforeSave()
    {
            if ($this->name == 'Peter') {
                    message = new Message("Sorry, but a robot cannot be named Peter");
                    $this->appendMessage(message);
            }
    }
}
doc_Phalcon
2016-10-16 09:52:11
Comments
Leave a Comment

Please login to continue.