Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

validators are seems to not calling on update when the form has entity object


I am using form validation in my Phlacon 3.0 project running on Apache/2.4.18 (Win64) OpenSSL/1.0.2e mod cgid/2.3.9 PHP/5.6.14. Everything works just fine when i inserting data, but when i try to update data inside any mandatory (required) <input type="text" ...> field and i leave that field blank (empty), my form submiting all data without rising an error from a PresenceOf validator asigned to that field. It seems that the validators are not calling at all in this case, or maybe somehow they use the values that comming from the given $entity object wich is a simple DB model with defined setters/getters functions. Is anyone else have the same problem and how to solve or workaraund that?

Excuse my bad english :(

P.S. This is not happens with <select ...> fields, it is only happens with <input type="text" ...> fields

edited Aug '16

I solved this problem alone :)

Thanks a lot for so many answers, mates! :) Just kidding :)

The problem was not in the form itselfs, but in the model where i used a check for empty value like this: if( empty( $value ) ) { throw new \InvalidArgumentException( 'Invalid Users.name1 {' . print_r($value, true) . '}' ); } It seem that somwhere in the validation process this setter is called (before validator PresenceOf !?), and trow exception from above and that's why i was misleded that form data are trying to save themselves into DB.

I hope this post maybe can save someone 11 days of investigatioon like was in my case :(