Skip to content

Commit d2f927e

Browse files
[Validator] Deprecate Constraint::$errorNames in favor of Constraint::ERROR_NAMES
1 parent 65e2e6d commit d2f927e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Validator/Constraints/UniqueEntity.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ class UniqueEntity extends Constraint
2626
{
2727
public const NOT_UNIQUE_ERROR = '23bd9dbf-6b9b-41cd-a99e-4844bcf3077f';
2828

29+
protected const ERROR_NAMES = [
30+
self::NOT_UNIQUE_ERROR => 'NOT_UNIQUE_ERROR',
31+
];
32+
2933
public $message = 'This value is already used.';
3034
public $service = 'doctrine.orm.validator.unique';
3135
public $em = null;
@@ -35,9 +39,10 @@ class UniqueEntity extends Constraint
3539
public $errorPath = null;
3640
public $ignoreNull = true;
3741

38-
protected static $errorNames = [
39-
self::NOT_UNIQUE_ERROR => 'NOT_UNIQUE_ERROR',
40-
];
42+
/**
43+
* @deprecated since Symfony 6.1, use const ERROR_NAMES instead
44+
*/
45+
protected static $errorNames = self::ERROR_NAMES;
4146

4247
/**
4348
* {@inheritdoc}

0 commit comments

Comments
 (0)