I'm using the Drupal 8 Entity Validation API. I've implemented my Constraint
and ConstraintValidator
classes and added them as a constraint against the relevant entity field.
If I understand the validate
method signature for ConstraintValidator
correctly, I'm given a list of fields ($items
) and the constraint ($constraint
). However, I need to retrieve the parent entity in my logic.
How can I get the parent entity while with the validation API?