Exemplo n.º 1
0
 /**
  * @return \Symfony\Component\Validator\Constraint[]
  */
 protected function createGlossaryKeyConstraints()
 {
     $constraints = $this->getFieldDefaultConstraints();
     $constraints[] = new Callback(['methods' => [function ($glossaryKey, ExecutionContextInterface $contextInterface) {
         if ($this->glossaryFacade->hasKey($glossaryKey)) {
             $contextInterface->addViolation('Translation key already exists.');
         }
     }], 'groups' => [self::GROUP_UNIQUE_GLOSSARY_KEY_CHECK]]);
     return $constraints;
 }
 /**
  * @param string $keyName
  *
  * @return bool
  */
 public function hasKey($keyName)
 {
     return $this->glossaryFacade->hasKey($keyName);
 }