Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
UniqueReferenceConstraint
n/a
0 / 0
n/a
0 / 0
0
n/a
0 / 0
1<?php
2
3namespace Drupal\crm\Plugin\Validation\Constraint;
4
5use Drupal\Core\StringTranslation\TranslatableMarkup;
6use Drupal\Core\Validation\Attribute\Constraint;
7use Symfony\Component\Validator\Constraint as SymfonyConstraint;
8
9/**
10 * Entity Reference unique reference constraint.
11 *
12 * Verifies that referenced entities referenced only once.
13 */
14#[Constraint(
15  id: 'UniqueReference',
16  label: new TranslatableMarkup('Unique Entity Reference reference', [], ['context' => 'Validation'])
17)]
18class UniqueReferenceConstraint extends SymfonyConstraint {
19
20  /**
21   * The default violation message.
22   *
23   * @var string
24   */
25  public $message = 'A @entity_type with @field_name referencing entity with ID @id already exists.';
26
27}