public function ClassMetadata::setGroupSequence

Sets the default group sequence for this class.

Parameters

array $groups An array of group names:

Return value

ClassMetadata

Throws

GroupDefinitionException

File

drupal/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/ClassMetadata.php, line 339

Class

ClassMetadata
Represents all the configured constraints on a given class.

Namespace

Symfony\Component\Validator\Mapping

Code

public function setGroupSequence(array $groups) {
  if ($this
    ->isGroupSequenceProvider()) {
    throw new GroupDefinitionException('Defining a static group sequence is not allowed with a group sequence provider');
  }
  if (in_array(Constraint::DEFAULT_GROUP, $groups, true)) {
    throw new GroupDefinitionException(sprintf('The group "%s" is not allowed in group sequences', Constraint::DEFAULT_GROUP));
  }
  if (!in_array($this
    ->getDefaultGroup(), $groups, true)) {
    throw new GroupDefinitionException(sprintf('The group "%s" is missing in the group sequence', $this
      ->getDefaultGroup()));
  }
  $this->groupSequence = $groups;
  return $this;
}