public static function __init(array $options = array()) { parent::__init($options); $self = static::_instance(); Comment::applyFilter('save', function ($self, $params, $chain) { $comment = $params['record']; if (!$comment->id) { $comment->created = date('Y-m-d h:i:s'); } else { $comment->modified = date('Y-m-d h:i:s'); } $params['record'] = $comment; return $chain->next($self, $params, $chain); }); Validator::add('validName', '/^[A-Za-z0-9\'\\s]+$/'); }