Form's isValid cannot access data from bound object #4218

sparrowek opened this Issue Apr 13, 2013 · 1 comment

3 participants


When binding object to a form:
validators can access only data set by setData() but does not see data from bound object. When bind() call extracts() and then populateValues() only element values are set but not $this->data.

Sometimes when editing a set of related entities I do not want to pass all entities' identifiers through POST since a user could tamper with it, e.g. I have a user and userDetails related to it through userDetails.userId FK, and only is passed through POST but userDetails.userId is filled by querying database so that they always match together.


This is the expected behaviour. If there's something you don't want form data to change you should either not include that element in the form or use a validation group to exclude it. In either case populateValues will then ignore the field and retain the values presently in the bound object.

@Maks3w this can be closed

@Maks3w Maks3w closed this Oct 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment