doctrine / DoctrineModule

Doctrine Module for Laminas
http://www.doctrine-project.org/projects/doctrine-module.html
MIT License
398 stars 269 forks source link

Undefined variable $mappingType #641

Closed SilverioMiranda closed 6 years ago

SilverioMiranda commented 6 years ago

See this function (https://github.com/doctrine/DoctrineModule/blob/master/src/DoctrineModule/Service/AbstractFactory.php#L78)

public function getOptions(ContainerInterface $container, $key, $name = null)
    {
        if ($name === null) {
            $name = $this->getName();
        }
        $options = $container->get('config');
        $options = $options['doctrine'];
        if ($mappingType = $this->getMappingType()) {
            $options = $options[$mappingType];
        }
        $options = isset($options[$key][$name]) ? $options[$key][$name] : null;
        if (null === $options) {
            throw new RuntimeException(
                sprintf(
                    'Options with name "%s" could not be found in "doctrine.%s".',
                    $name,
                    $key
                )
            );
        }
        $optionsClass = $this->getOptionsClass();
        return new $optionsClass($options);
    }

Is $mappingType a valid variable?

Ocramius commented 6 years ago

Yes, that's an intentional assignment. With doctrine/coding-standard this kind of assignment will no longer be allowed.