Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugs on getMessages() #24

Closed
achrafsoltani opened this issue Apr 17, 2015 · 1 comment
Closed

bugs on getMessages() #24

achrafsoltani opened this issue Apr 17, 2015 · 1 comment

Comments

@achrafsoltani
Copy link

this function only returns erros on the first element when trying to validate a data array(), and the custom error message is not parsed nore taken into account

for something like
array('name', 'required | maxlength(max=25) | minlength(min=3)({label} must have between {min} and {max} characters)(Name)',
'activity', 'required | maxlength(max=25) | minlength(min=3)({label} must have between {min} and {max} characters)(Activity)');

I get

array(1) { ["name"]=> array(1) { [0]=> object(Sirius\Validation\ErrorMessage)#713 (2) { ["template":protected]=> string(22) "This field is required" ["variables":protected]=> array(1) { ["value"]=> string(0) "" } } } }

@adrianmiu
Copy link
Contributor

That's because, the way you wrote it you have defined only one rule; the one for the name.
If you want to define multiple rules at once you have to do something like

$validator->add(array(
    'title' => 'required | maxlength(max=10)({label} must have less than {max} characters)(Title)',
    'content' => 'required',
    'source' => 'website'
));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants