Skip to content

Commit

Permalink
fixed issn validator
Browse files Browse the repository at this point in the history
  • Loading branch information
yazbahar committed Nov 3, 2016
1 parent e849b0e commit 0218b0f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Ojs/JournalBundle/Validator/JournalIssnValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,17 @@ public function __construct(EntityManager $em)
*/
public function validate($value, Constraint $constraint)
{
if (!empty($value) && $this->em->getRepository(Journal::class)->findBy(['issn' => $value, 'eissn' => $value])) {
$qb = $this->em->getRepository(Journal::class);
$query = $qb->createQueryBuilder('j')
->where('j.issn = :value')
->orWhere('j.eissn = :value')
->setParameter('value',$value)
->getQuery()
->getResult();

dump($query);

if (!empty($value) && $query) {
$this->context->addViolation($constraint->message);
}
}
Expand Down

0 comments on commit 0218b0f

Please sign in to comment.