Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ClassMetadata.php

function ClassMetadata::setGroupSequence

Sets the default group sequence for this class.

Parameters

string[]|GroupSequence $groupSequence An array of group names:

Return value

$this

Throws

GroupDefinitionException

File

vendor/symfony/validator/Mapping/ClassMetadata.php, line 388

Class

ClassMetadata
Default implementation of {@link ClassMetadataInterface}.

Namespace

Symfony\Component\Validator\Mapping

Code

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal