OptionsResolverWrapper example

protected function collectOptions(ResolvedFormTypeInterface $type): void
    {
        $this->parents = [];
        $this->extensions = [];

        if (null !== $type->getParent()) {
            $optionsResolver = clone $this->getParentOptionsResolver($type->getParent());
        } else {
            $optionsResolver = new OptionsResolver();
        }

        $type->getInnerType()->configureOptions($ownOptionsResolver = new OptionsResolverWrapper());
        $this->ownOptions = array_diff($ownOptionsResolver->getDefinedOptions()$optionsResolver->getDefinedOptions());
        $overriddenOptions = array_intersect(array_merge($ownOptionsResolver->getDefinedOptions()$ownOptionsResolver->getUndefinedOptions())$optionsResolver->getDefinedOptions());

        $this->parentOptions = [];
        foreach ($this->parents as $class => $parentOptions) {
            $this->overriddenOptions[$class] = array_intersect($overriddenOptions$parentOptions);
            $this->parentOptions[$class] = array_diff($parentOptions$overriddenOptions);
        }

        $type->getInnerType()->configureOptions($optionsResolver);
        $this->collectTypeExtensionsOptions($type$optionsResolver);
        
Home | Imprint | This part of the site doesn't use cookies.