Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291671

[PP-1] Add CompositeConstraintBase so that constraints involving multiple fields, such as CommentNameConstraint, can be discovered

$
0
0

Postponed on #2343035: Upgrade validator integration for Symfony versions 2.5+, see #46.

Motivation

For #2395831: [PP-2] Entity forms skip validation of fields that are not in the EntityFormDisplay we need to solve conditional field validation, i.e. validation value of field A in dependence of the value field B. #2395831: [PP-2] Entity forms skip validation of fields that are not in the EntityFormDisplay requires that we have knowledge about all involved fields A and B.
As #2395831: [PP-2] Entity forms skip validation of fields that are not in the EntityFormDisplay is critical, bumping this to critical as well.

Proposed resolution

Add a new base class for such constraints and call it CompositeConstraintBase.
Ensure covered fields are specified for that constraints and test that information is available from violations.
Convert our single use-case in core CommentNameConstraintValidator to the new base class.

Remaining tasks

Get #2343035: Upgrade validator integration for Symfony versions 2.5+ done.
Implement it.

User interface changes

-

API changes

-

Original report by fago:
Quoting from #2015687-46: Convert field type to FieldType plugin for taxonomy module which describes a needed feature for entity validation:

2). A conditional field. For example, a field contains two elements, when user chooses 'pre-defined' for first element, we need to validate the other element for options list. When user chooses 'Custom', we don't need to validate the pre-defined option list.

Right now, you can do that by
a) writing your own constraint plugin or
b) use the Callback constraint + a custom validation callback instead
b) dynamically providing your own constraints from within getConstraints().
c) Symfony suggests using validation groups: http://symfony.com/doc/current/book/validation.html#group-sequence-provi...

Let's figure out what the pos/cons are on this topic and document what's the best approach.
Related symfony PR (that got reverted) - "dynamic constraints".


Viewing all articles
Browse latest Browse all 291671

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>