Description
Description
The new auto-mapping validation feature is activated via configuration. I think this is too obtuse, and people are wondering "Why is this field required? Where did that validation come from"?
The problem is that ALL your validation currently lives as annotations (or XML, YAML)... except that now this automatic system is activated in an entirely different location. Additionally, the auto-mapping (as nice at it is) is imperfect - and always will be - automatic things will never always get it right. For example, make:registration
is broken with auto-mapping as the feature adds NotNull
to the $password
field, which will eventually hold the encoded password. This field should not have validation - symfony/maker-bundle#412
Additionally, an annotation would allow you to specify the validation group.
Example
/**
* @Entity()
* @Assert\AddAutomaticConstraints()
*/
class User
{
}
And ideally you could disable it automatic constraints on a property-by-property basis:
/**
* @Entity()
* @AddAutomaticConstraints()
*/
class User
{
// ...
/**
* @NoAutomaticConstraints()
*/
private $password;
}
This makes the feature a bit less useful, I admit. But my initial instinct is that this is causing a bit more pain than convenience.
Btw, an added problem is that the presence/absence of symfony/property-info
makes this feature behave differently - and that's very not obvious.