You are here

public function ClassMetadata::setGroupSequenceProvider in Plug 7

Sets whether a group sequence provider should be used.

Parameters

bool $active:

Throws

GroupDefinitionException

File

lib/Symfony/validator/Symfony/Component/Validator/Mapping/ClassMetadata.php, line 506

Class

ClassMetadata
Default implementation of {@link ClassMetadataInterface}.

Namespace

Symfony\Component\Validator\Mapping

Code

public function setGroupSequenceProvider($active) {
  if ($this
    ->hasGroupSequence()) {
    throw new GroupDefinitionException('Defining a group sequence provider is not allowed with a static group sequence');
  }
  if (!$this
    ->getReflectionClass()
    ->implementsInterface('Symfony\\Component\\Validator\\GroupSequenceProviderInterface')) {
    throw new GroupDefinitionException(sprintf('Class "%s" must implement GroupSequenceProviderInterface', $this->name));
  }
  $this->groupSequenceProvider = $active;
}