Mvc\Model\Message

Class Phalcon\Mvc\Model\Message

implements Phalcon\Mvc\Model\MessageInterface

Encapsulates validation info generated before save/delete records fails

use Phalcon\Mvc\Model\Message as Message;

  class Robots extends Phalcon\Mvc\Model
  {

    public function beforeSave()
    {
      if ($this->name == 'Peter') {
        $text = "A robot cannot be named Peter";
        $field = "name";
        $type = "InvalidValue";
        $code = 103;
        $message = new Message($text, $field, $type, $code);
        $this->appendMessage($message);
     }
   }

 }

Methods

public __construct (string $message, [string $field], [string $type])

Phalcon\Mvc