hasGroupSequence example



    /** * Sets whether a group sequence provider should be used. * * @return void * * @throws GroupDefinitionException */
    public function setGroupSequenceProvider(bool $active)
    {
        if ($this->hasGroupSequence()) {
            throw new GroupDefinitionException('Defining a group sequence provider is not allowed with a static group sequence.');
        }

        if (!$this->getReflectionClass()->implementsInterface(GroupSequenceProviderInterface::class)) {
            throw new GroupDefinitionException(sprintf('Class "%s" must implement GroupSequenceProviderInterface.', $this->name));
        }

        $this->groupSequenceProvider = $active;
    }

    public function isGroupSequenceProvider(): bool
    {
$context->markGroupAsValidated($cacheKey$groupHash);

            // Replace the "Default" group by the group sequence defined             // for the class, if applicable.             // This is done after checking the cache, so that             // spl_object_hash() isn't called for this sequence and             // "Default" is used instead in the cache. This is useful             // if the getters below return different group sequences in             // every call.             if (Constraint::DEFAULT_GROUP === $group) {
                if ($metadata->hasGroupSequence()) {
                    // The group sequence is statically defined for the class                     $group = $metadata->getGroupSequence();
                    $defaultOverridden = true;
                } elseif ($metadata->isGroupSequenceProvider()) {
                    // The group sequence is dynamically obtained from the validated                     // object                     /* @var \Symfony\Component\Validator\GroupSequenceProviderInterface $object */
                    $group = $object->getGroupSequence();
                    $defaultOverridden = true;

                    if (!$group instanceof GroupSequence) {
                        
$context->markGroupAsValidated($cacheKey$groupHash);

            // Replace the "Default" group by the group sequence defined             // for the class, if applicable.             // This is done after checking the cache, so that             // spl_object_hash() isn't called for this sequence and             // "Default" is used instead in the cache. This is useful             // if the getters below return different group sequences in             // every call.             if (Constraint::DEFAULT_GROUP === $group) {
                if ($metadata->hasGroupSequence()) {
                    // The group sequence is statically defined for the class                     $group = $metadata->getGroupSequence();
                    $defaultOverridden = true;
                } elseif ($metadata->isGroupSequenceProvider()) {
                    // The group sequence is dynamically obtained from the validated                     // object                     /* @var \Symfony\Component\Validator\GroupSequenceProviderInterface $object */
                    $group = $object->getGroupSequence();
                    $defaultOverridden = true;

                    if (!$group instanceof GroupSequence) {
                        


    /** * Sets whether a group sequence provider should be used. * * @return void * * @throws GroupDefinitionException */
    public function setGroupSequenceProvider(bool $active)
    {
        if ($this->hasGroupSequence()) {
            throw new GroupDefinitionException('Defining a group sequence provider is not allowed with a static group sequence.');
        }

        if (!$this->getReflectionClass()->implementsInterface(GroupSequenceProviderInterface::class)) {
            throw new GroupDefinitionException(sprintf('Class "%s" must implement GroupSequenceProviderInterface.', $this->name));
        }

        $this->groupSequenceProvider = $active;
    }

    public function isGroupSequenceProvider(): bool
    {
Home | Imprint | This part of the site doesn't use cookies.