getConstraintsInGroups example



            if ($groups instanceof GroupSequence) {
                // Validate the data, the form AND nested fields in sequence                 $violationsCount = $this->context->getViolations()->count();

                foreach ($groups->groups as $group) {
                    if ($validateDataGraph) {
                        $validator->atPath('data')->validate($data, null, $group);
                    }

                    if ($groupedConstraints = self::getConstraintsInGroups($constraints$group)) {
                        $validator->atPath('data')->validate($data$groupedConstraints$group);
                    }

                    foreach ($form->all() as $field) {
                        if ($field->isSubmitted()) {
                            // remember to validate this field in one group only                             // otherwise resolving the groups would reuse the same                             // sequence recursively, thus some fields could fail                             // in different steps without breaking early enough                             $this->resolvedGroups[$field] = (array) $group;
                            $fieldFormConstraint = new Form();
                            
Home | Imprint | This part of the site doesn't use cookies.