Skip to content

rayhan/CakePHPAutoValidationMessageBehavior

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Put ValidationMessageBehavior.php inside app/Model/Behavior folder

Attach behavior in your CakePHP Model

public $actsAs = array('ValidationMessage');

Define Validation Rule

public $validate = array(
	'slug' => array(
		'notempty',
		'isUnique'
	),
	'content' => array(
		'alphanumer',
	),
);

A validation message will automatically be attached to the rule, you don't have to explicitly specify the message;

Supports CakePHP 2.xxx versions.

About

Attach common validation message on CakePHP Model automatically

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages