GroupSequence

GroupSequence

class GroupSequence

A sequence of validation groups.

When validating a group sequence, each group will only be validated if all of the previous groups in the sequence succeeded. For example:

$validator->validate($address, null, new GroupSequence(array('Basic', 'Strict')));

In the first step, all constraints that belong to the group "Basic" will be validated. If none of the constraints fail, the validator will then validate the constraints in group "Strict". This is useful, for example, if "Strict" contains expensive checks that require a lot of CPU or slow, external services. You usually don't want to run expensive checks if any of the cheap checks fail.

When adding metadata to a class, you can override the "Default" group of that class with a group sequence:

/**
 * @GroupSequence({"Address", "Strict"})
 *\/
class Address
{
    /