Version 1
[yaffs-website] / web / core / modules / system / tests / modules / entity_test / src / Plugin / Validation / Constraint / EntityTestCompositeConstraint.php
diff --git a/web/core/modules/system/tests/modules/entity_test/src/Plugin/Validation/Constraint/EntityTestCompositeConstraint.php b/web/core/modules/system/tests/modules/entity_test/src/Plugin/Validation/Constraint/EntityTestCompositeConstraint.php
new file mode 100644 (file)
index 0000000..5a27509
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+namespace Drupal\entity_test\Plugin\Validation\Constraint;
+
+use Drupal\Core\Entity\Plugin\Validation\Constraint\CompositeConstraintBase;
+
+/**
+ * Constraint with multiple fields.
+ *
+ * @Constraint(
+ *   id = "EntityTestComposite",
+ *   label = @Translation("Constraint with multiple fields."),
+ *   type = "entity"
+ * )
+ */
+class EntityTestCompositeConstraint extends CompositeConstraintBase {
+
+  public $message = 'Multiple fields are validated';
+
+  /**
+   * {@inheritdoc}
+   */
+  public function coversFields() {
+    return ['name', 'type'];
+  }
+
+}