public function handleViolations(FormEvent $event)
    {
        $formTabs = $event->getForm()->getConfig()->getAttribute('easyadmin_form_tabs');

        $firstTabWithErrors = null;
        foreach ($event->getForm() as $child) {
            $errors = $child->getErrors(true);

            if (\count($errors) > 0) {
                $formTab = $child->getConfig()->getAttribute('easyadmin_form_tab');
                $formTabs[$formTab]['errors'] += \count($errors);

                if (null === $firstTabWithErrors) {
                    $firstTabWithErrors = $formTab;
                }
            }
        }

        // ensure that the first tab with errors is displayed
        $firstTab = \key($formTabs);
        if ($firstTab !== $firstTabWithErrors) {
            $formTabs[$firstTab]['active'] = false;
            $formTabs[$firstTabWithErrors]['active'] = true;
        }
    }
public function handleViolations(FormEvent $event)
    {
        $formTabs = $event->getForm()->getConfig()->getAttribute('easyadmin_form_tabs');

        $firstTabWithErrors = null;
        foreach ($event->getForm() as $child) {
            $errors = $child->getErrors(true);

            if (\count($errors) > 0) {
                $formTab = $child->getConfig()->getAttribute('easyadmin_form_tab');
                $formTabs[$formTab]['errors'] += \count($errors);

                if (null === $firstTabWithErrors) {
                    $firstTabWithErrors = $formTab;
                }
            }
        }

        // ensure that the first tab with errors is displayed
        $firstTab = \key($formTabs);
        if ($firstTab !== $firstTabWithErrors) {
            $formTabs[$firstTab]['active'] = false;
            $formTabs[$firstTabWithErrors]['active'] = true;
        }
    }
public function handleViolations ( FormEvent $ event ) { $ formTabs = $ event -> getForm ( ) -> getConfig ( ) -> getAttribute ( 'easyadmin_form_tabs' ) ; $ firstTabWithErrors = null ; foreach ( $ event -> getForm ( ) as $ child ) { $ errors = $ child -> getErrors ( true ) ; if ( \ count ( $ errors ) > 0 ) { $ formTab = $ child -> getConfig ( ) -> getAttribute ( 'easyadmin_form_tab' ) ; $ formTabs [ $ formTab ] [ 'errors' ] += \ count ( $ errors ) ; if ( null === $ firstTabWithErrors ) { $ firstTabWithErrors = $ formTab ; } } } // ensure that the first tab with errors is displayed $ firstTab = \ key ( $ formTabs ) ; if ( $ firstTab !== $ firstTabWithErrors ) { $ formTabs [ $ firstTab ] [ 'active' ] = false ; $ formTabs [ $ firstTabWithErrors ] [ 'active' ] = true ; } }
Deal with form constraint violations. This method has to be executed with
a negative priority to make sure that the validation process is done.

@param FormEvent $event
Deal with form constraint violations . This method has to be executed with a negative priority to make sure that the validation process is done .