src/Form/Extension/FormTypeExtension.php
protected function findConstraints(FormInterface $form)
    {
        $constraints = new ConstraintCollection();

        // Find constraints configured with the form
        $formConstraints = $form->getConfig()->getOption('constraints');
        if (!empty($formConstraints)) {
            if (is_array($formConstraints)) {
                $constraints->addCollection(
                    new ConstraintCollection($formConstraints)
                );
            } else {
                $constraints->add($formConstraints);
            }
        }

        // Find constraints bound by data
        if ($form->getConfig()->getMapped()) {
            $constraints->addCollection(
                $this->constraintFinder->find($form)
            );
        }

        return $constraints;
    }
protected function findConstraints(FormInterface $form)
    {
        $constraints = new ConstraintCollection();

        // Find constraints configured with the form
        $formConstraints = $form->getConfig()->getOption('constraints');
        if (!empty($formConstraints)) {
            if (is_array($formConstraints)) {
                $constraints->addCollection(
                    new ConstraintCollection($formConstraints)
                );
            } else {
                $constraints->add($formConstraints);
            }
        }

        // Find constraints bound by data
        if ($form->getConfig()->getMapped()) {
            $constraints->addCollection(
                $this->constraintFinder->find($form)
            );
        }

        return $constraints;
    }
protected function findConstraints ( FormInterface $ form ) { $ constraints = new ConstraintCollection ( ) ; // Find constraints configured with the form $ formConstraints = $ form -> getConfig ( ) -> getOption ( 'constraints' ) ; if ( ! empty ( $ formConstraints ) ) { if ( is_array ( $ formConstraints ) ) { $ constraints -> addCollection ( new ConstraintCollection ( $ formConstraints ) ) ; } else { $ constraints -> add ( $ formConstraints ) ; } } // Find constraints bound by data if ( $ form -> getConfig ( ) -> getMapped ( ) ) { $ constraints -> addCollection ( $ this -> constraintFinder -> find ( $ form ) ) ; } return $ constraints ; }
Find all constraints for the given FormInterface.

@param FormInterface $form
@return ConstraintCollection
Find all constraints for the given FormInterface .