|
@@ -18,25 +18,27 @@ class TagsValidator extends ConstraintValidator
|
18
|
18
|
|
19
|
19
|
public function isValid($value, Constraint $constraint)
|
20
|
20
|
{
|
21
|
|
- if (array_diff($value, array_unique($value)))
|
|
21
|
+ if (count($value))
|
22
|
22
|
{
|
23
|
|
- $this->setMessage('Tags saisies incorrects');
|
24
|
|
- return false;
|
25
|
|
- }
|
26
|
|
-
|
27
|
|
- $count = $this->entityManager
|
28
|
|
- ->createQuery("SELECT COUNT(t)
|
29
|
|
- FROM MuzichCoreBundle:Tag t
|
30
|
|
- WHERE t IN (:tids)")
|
31
|
|
- ->setParameter('tids', $value)
|
32
|
|
- ->getSingleScalarResult();
|
33
|
|
-
|
34
|
|
- if ($count != count ($value))
|
35
|
|
- {
|
36
|
|
- $this->setMessage('Tags saisies incorrects');
|
37
|
|
- return false;
|
|
23
|
+ if (array_diff($value, array_unique($value)))
|
|
24
|
+ {
|
|
25
|
+ $this->setMessage('Tags saisies incorrects');
|
|
26
|
+ return false;
|
|
27
|
+ }
|
|
28
|
+
|
|
29
|
+ $count = $this->entityManager
|
|
30
|
+ ->createQuery("SELECT COUNT(t)
|
|
31
|
+ FROM MuzichCoreBundle:Tag t
|
|
32
|
+ WHERE t IN (:tids)")
|
|
33
|
+ ->setParameter('tids', $value)
|
|
34
|
+ ->getSingleScalarResult();
|
|
35
|
+
|
|
36
|
+ if ($count != count ($value))
|
|
37
|
+ {
|
|
38
|
+ $this->setMessage('Tags saisies incorrects');
|
|
39
|
+ return false;
|
|
40
|
+ }
|
38
|
41
|
}
|
39
|
|
-
|
40
|
42
|
return true;
|
41
|
43
|
}
|
42
|
44
|
}
|