DDC-580: loadMappingFile in XmlDriver #5086

Closed
doctrinebot opened this Issue May 9, 2010 · 2 comments

1 participant

@doctrinebot

Jira issue originally created by user needle:

There is just a minor bug on XmlDriver.

The actual code is :

protected function _loadMappingFile($file)
    {
        $result = array();
        $xmlElement = simplexml*load*file($file);

        if (isset($xmlElement->entity)) {
            foreach ($xmlElement->entity as $entityElement) {
                $entityName = (string)$entityElement['name'];
                $result[$entityName] = $entityElement;
            }
        } else if (isset($xmlElement->{'mapped-superclass'})) {
            foreach ($xmlElement->{'mapped-superclass'} as $mapperSuperClass) {
                $className = (string)$mappedSuperClass['name'];
                $result[$className] = $mappedSuperClass;
            }
        }

        return $result;
    }

The error is on the foreach section. The code should be :

protected function _loadMappingFile($file)
    {
        $result = array();
        $xmlElement = simplexml*load*file($file);

        if (isset($xmlElement->entity)) {
            foreach ($xmlElement->entity as $entityElement) {
                $entityName = (string)$entityElement['name'];
                $result[$entityName] = $entityElement;
            }
        } else if (isset($xmlElement->{'mapped-superclass'})) {
            foreach ($xmlElement->{'mapped-superclass'} as $mappedSuperClass) {
                $className = (string)$mappedSuperClass['name'];
                $result[$className] = $mappedSuperClass;
            }
        }

        return $result;
    }
@doctrinebot

Comment created by shurakai:

Fixed in http://github.com/Shurakai/doctrine2 and should be fixed in trunk soon.

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.0-BETA2 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment