DDC-389: The Method loadMetadataForClass from Phpdriver when using the orm tool to export from php classes, redlcares the superclass #486

Closed
opened 2026-01-22 12:40:00 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Mar 3, 2010).

Jira issue originally created by user tferreira:


/****
  * @Entity @Table(name="object")
  * @InheritanceType("JOINED")
  * @DiscriminatorColumn(name="prototype", type="string")
  * @DiscriminatorMap({"Object2"="ObjectTwo", "Object3"="ObjectThree"})
  */

class Object
{
}

/****
  * @Entity @Table(name="object2")
  */

class ObjectTwo extends Object
{
}


/****
  * @Entity @Table(name="object3")
  */

class ObjecThree extends Object
{
}

So when i try this:

$cme = new \Doctrine\ORM\Tools\Export\ClassMetadataExporter();
$cme->addMappingSource('/path/to/php', 'php');
$metadatas = $cme->getMetadatasForMappingSources();
print_r($metadatas);

returns this:

*Fatal error:* Cannot redeclare class FLData\FLDataObject in /path/to/php/Object.php on line 13

If I in the PhpDriver.php change from this:

    public function loadMetadataForClass($className, ClassMetadataInfo $metadata)
    {
        $path = $this->_classPaths[$className];
        include $path;
    }

to this:

    public function loadMetadataForClass($className, ClassMetadataInfo $metadata)
    {
        $path = $this->_classPaths[$className];
        include_once $path;
    }

it's works

Originally created by @doctrinebot on GitHub (Mar 3, 2010). Jira issue originally created by user tferreira: ``` java /**** * @Entity @Table(name="object") * @InheritanceType("JOINED") * @DiscriminatorColumn(name="prototype", type="string") * @DiscriminatorMap({"Object2"="ObjectTwo", "Object3"="ObjectThree"}) */ class Object { } /**** * @Entity @Table(name="object2") */ class ObjectTwo extends Object { } /**** * @Entity @Table(name="object3") */ class ObjecThree extends Object { } ``` So when i try this: ``` java $cme = new \Doctrine\ORM\Tools\Export\ClassMetadataExporter(); $cme->addMappingSource('/path/to/php', 'php'); $metadatas = $cme->getMetadatasForMappingSources(); print_r($metadatas); ``` returns this: **Fatal error:\* Cannot redeclare class FLData\FLDataObject in _/path/to/php/Object.php_ on line *13** If I in the PhpDriver.php change from this: ``` java public function loadMetadataForClass($className, ClassMetadataInfo $metadata) { $path = $this->_classPaths[$className]; include $path; } ``` to this: ``` java public function loadMetadataForClass($className, ClassMetadataInfo $metadata) { $path = $this->_classPaths[$className]; include_once $path; } ``` it's works
admin added the Bug label 2026-01-22 12:40:00 +01:00
admin closed this issue 2026-01-22 12:40:00 +01:00
Author
Owner

@doctrinebot commented on GitHub (Mar 3, 2010):

Comment created by @guilhermeblanco:

In r7306 this issue was fixed

@doctrinebot commented on GitHub (Mar 3, 2010): Comment created by @guilhermeblanco: In r7306 this issue was fixed
Author
Owner

@doctrinebot commented on GitHub (Mar 3, 2010):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Mar 3, 2010): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#486