Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| RelationshipLimitConstraint | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace Drupal\crm\Plugin\Validation\Constraint; |
| 4 | |
| 5 | use Drupal\Core\StringTranslation\TranslatableMarkup; |
| 6 | use Drupal\Core\Validation\Attribute\Constraint; |
| 7 | use Symfony\Component\Validator\Constraint as SymfonyConstraint; |
| 8 | |
| 9 | /** |
| 10 | * Checks that relationship limits are not exceeded. |
| 11 | */ |
| 12 | #[Constraint( |
| 13 | id: 'RelationshipLimit', |
| 14 | label: new TranslatableMarkup('Relationship Limit', [], ['context' => 'Validation']) |
| 15 | )] |
| 16 | class RelationshipLimitConstraint extends SymfonyConstraint { |
| 17 | |
| 18 | /** |
| 19 | * The message shown when the limit for Contact A is exceeded. |
| 20 | * |
| 21 | * @var string |
| 22 | */ |
| 23 | public $limitExceededMessageA = 'This contact already has @count @type relationship(s) in the @label position. The maximum allowed is @limit.'; |
| 24 | |
| 25 | /** |
| 26 | * The message shown when the limit for Contact B is exceeded. |
| 27 | * |
| 28 | * @var string |
| 29 | */ |
| 30 | public $limitExceededMessageB = 'This contact already has @count @type relationship(s) in the @label position. The maximum allowed is @limit.'; |
| 31 | |
| 32 | } |