We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
empty()
1 parent e37545d commit 6d96285Copy full SHA for 6d96285
src/EntityExistValidator.php
@@ -23,14 +23,14 @@ public function __construct(EntityManagerInterface $entityManager)
23
24
public function validate($value, Constraint $constraint): void
25
{
26
- if (empty($value)) {
27
- return;
28
- }
29
-
30
if (!$constraint instanceof EntityExist) {
31
throw new \LogicException(\sprintf('You can only pass %s constraint to this validator.', EntityExist::class));
32
}
33
+ if (null === $value || '' === $value) {
+ return;
+ }
+
34
if (empty($constraint->entity)) {
35
throw new \LogicException(\sprintf('Must set "entity" on "%s" validator', EntityExist::class));
36
0 commit comments