public function saveIfNotExists(Route $route, $parameter, RouteParameterType $type)
 {
     $parameterEntity = $this->findOneByRouteAndParameter($route, $parameter);
     if ($parameterEntity) {
         $parameterEntity->setType($type);
         $this->save($parameterEntity);
         return $parameterEntity;
     }
     $parameterEntity = new RouteParameter();
     $parameterEntity->setRoute($route);
     $route->addParameter($parameterEntity);
     $parameterEntity->setParameter($parameter);
     $parameterEntity->setType($type);
     $this->save($parameterEntity);
     return $parameterEntity;
 }
 protected function addValueTextField(FormInterface $form, RouteParameter $parameter)
 {
     $constraints = [$this->createRegexConstaint($parameter->getRequirement())];
     if (!$parameter->getDefaultValue()) {
         $constraints[] = $this->createNotBlankConstraint();
     }
     $parameterName = $this->getParameterName($parameter);
     $defaultValue = $parameter->getDefaultValue();
     $form->add('value', TextType::class, ['label' => $defaultValue ? sprintf('Value for "%s", leave blank to use default (current: %s)', $parameterName, $defaultValue) : sprintf('Value for "%s"', $parameterName), 'attr' => ['placeholder' => $defaultValue ? sprintf('Value for "%s", leave blank to use default (current: %s)', $parameterName, $defaultValue) : $parameterName], 'constraints' => $constraints, 'required' => $defaultValue ? false : true]);
 }