Symfony\Component\Form\Extension\Validator\Constraints\FormValidator::getValidationGroups PHP Method

getValidationGroups() private static method

Returns the validation groups of the given form.
private static getValidationGroups ( Symfony\Component\Form\FormInterface $form ) : array
$form Symfony\Component\Form\FormInterface The form
return array The validation groups
    private static function getValidationGroups(FormInterface $form)
    {
        // Determine the clicked button of the complete form tree
        $clickedButton = null;

        if (method_exists($form, 'getClickedButton')) {
            $clickedButton = $form->getClickedButton();
        }

        if (null !== $clickedButton) {
            $groups = $clickedButton->getConfig()->getOption('validation_groups');

            if (null !== $groups) {
                return self::resolveValidationGroups($groups, $form);
            }
        }

        do {
            $groups = $form->getConfig()->getOption('validation_groups');

            if (null !== $groups) {
                return self::resolveValidationGroups($groups, $form);
            }

            $form = $form->getParent();
        } while (null !== $form);

        return array(Constraint::DEFAULT_GROUP);
    }