FOSUserBundle icon indicating copy to clipboard operation
FOSUserBundle copied to clipboard

Can't seem to override orm constraint mapping

Open jenkoian opened this issue 12 years ago • 2 comments

tl;dr Overriding config/validation/orm.xml into my custom bundle (as talked about here http://symfony.com/doc/master/cookbook/bundles/inheritance.html#overriding-resources-templates-routing-validation-etc) doesn't seem to work.


I need to set a custom repositoryMethod for the UniqueEntity constraint on the emailCanonical field (https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/config/validation/orm.xml#L18). The easiest way to do this I thought was to override the validation file as described in the tl;dr above. However, doing so doesn't seem to work.

I can override the file config/validation.xml and indeed add my custom constraint mapping within this, however because of the ValidationCompilerPass it does not replace the constraint within config/validation/orm.xml but just adds another. Disabling the compiler pass within the FOSUserBundle makes it do what I want.

Is the ValidationPass stopping these files from being overridden or should I be trying to override this constraint in a different manner?

jenkoian avatar Jun 07 '13 12:06 jenkoian

It's a framework limitation: symfony/symfony#3224

mvrhov avatar Jun 07 '13 18:06 mvrhov

Thanks @mvrhov that is exactly the problem I'm encountering. Have got around it with validation groups but it isn't ideal.

jenkoian avatar Jun 10 '13 08:06 jenkoian