Change record status: 
Project: 
Introduced in branch: 
8.0.x
Introduced in version: 
8.0.0-beta11
Description: 
  • Constrains which act on multiple fields can now be defined using Drupal\Core\Entity\Plugin\Validation\Constraint\CompositeConstraintBase.
  • There constrains can specify via the coversFields() method to which fields they apply to
  • Those constraints have to be added on the entity level - see https://www.drupal.org/node/2438011.
  • Violations can be added to the respective fields with code like the following:
              $context->buildViolation('Please enter a number between %min and %max.')
                  ->setParameter('%min', 3)
                  ->setParameter('%max', 10)
                  ->atPath('number')
                  ->addViolation();
    
  • For an example, take a look at the CommentName constraint of the comment module.
Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done