-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,8 @@ class SymfonyValidator implements IEntityValidator | |
|
||
private ?string $translationDomain = null; | ||
|
||
private ?array $groups = null; | ||
Check failure on line 24 in src/Core/Mapping/Validator/SymfonyValidator.php GitHub Actions / Codesniffer / Codesniffer (8.2)
Check failure on line 24 in src/Core/Mapping/Validator/SymfonyValidator.php GitHub Actions / Phpstan / Phpstan (8.2)
Check failure on line 24 in src/Core/Mapping/Validator/SymfonyValidator.php GitHub Actions / Codesniffer / Codesniffer (8.2)
Check failure on line 24 in src/Core/Mapping/Validator/SymfonyValidator.php GitHub Actions / Phpstan / Phpstan (8.2)
Check failure on line 24 in src/Core/Mapping/Validator/SymfonyValidator.php GitHub Actions / Codesniffer / Codesniffer (8.2)
|
||
|
||
public function __construct(?Reader $reader = null) | ||
{ | ||
$this->reader = $reader; | ||
|
@@ -42,6 +44,11 @@ public function setTranslationDomain(string $translationDomain): void | |
$this->translationDomain = $translationDomain; | ||
} | ||
|
||
public function setGroups(array $groups): void | ||
Check failure on line 47 in src/Core/Mapping/Validator/SymfonyValidator.php GitHub Actions / Codesniffer / Codesniffer (8.2)
Check failure on line 47 in src/Core/Mapping/Validator/SymfonyValidator.php GitHub Actions / Phpstan / Phpstan (8.2)
Check failure on line 47 in src/Core/Mapping/Validator/SymfonyValidator.php GitHub Actions / Codesniffer / Codesniffer (8.2)
Check failure on line 47 in src/Core/Mapping/Validator/SymfonyValidator.php GitHub Actions / Phpstan / Phpstan (8.2)
Check failure on line 47 in src/Core/Mapping/Validator/SymfonyValidator.php GitHub Actions / Codesniffer / Codesniffer (8.2)
|
||
{ | ||
$this->groups = $groups; | ||
} | ||
|
||
/** | ||
* @throws ValidationException | ||
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint | ||
|
@@ -67,7 +74,7 @@ public function validate(object $entity): void | |
$validator = $validatorBuilder->getValidator(); | ||
|
||
/** @var ConstraintViolationListInterface $violations */ | ||
$violations = $validator->validate($entity); | ||
$violations = $validator->validate($entity, null, $this->groups); | ||
|
||
if (count($violations) > 0) { | ||
$fields = []; | ||
|