EventListener/FormSubscriber.php
public function validate(FormEvent $event)
    {
        /** @var Alias $alias */
        $alias = $event->getData()->getNode()->alias;

        if ($alias instanceof ValueHolderInterface) {
            $alias = $alias->getWrappedValueHolderValue();
        }

        $violations = $this->validator->validate($alias);

        if (!$violations) {
            return;
        }

        $mapper = new ViolationMapper();
        /** @var ConstraintViolationInterface $violation */
        foreach ($violations as $violation) {
            $mapper->mapViolation($violation, $event->getForm(), true);
        }
    }
public function validate(FormEvent $event)
    {
        /** @var Alias $alias */
        $alias = $event->getData()->getNode()->alias;

        if ($alias instanceof ValueHolderInterface) {
            $alias = $alias->getWrappedValueHolderValue();
        }

        $violations = $this->validator->validate($alias);

        if (!$violations) {
            return;
        }

        $mapper = new ViolationMapper();
        /** @var ConstraintViolationInterface $violation */
        foreach ($violations as $violation) {
            $mapper->mapViolation($violation, $event->getForm(), true);
        }
    }
public function validate ( FormEvent $ event ) { /** @var Alias $alias */ $ alias = $ event -> getData ( ) -> getNode ( ) -> alias ; if ( $ alias instanceof ValueHolderInterface ) { $ alias = $ alias -> getWrappedValueHolderValue ( ) ; } $ violations = $ this -> validator -> validate ( $ alias ) ; if ( ! $ violations ) { return ; } $ mapper = new ViolationMapper ( ) ; /** @var ConstraintViolationInterface $violation */ foreach ( $ violations as $ violation ) { $ mapper -> mapViolation ( $ violation , $ event -> getForm ( ) , true ) ; } }
Validate if the Alias is valid and unique.

@param FormEvent $event
Validate if the Alias is valid and unique .