DDC-939: Database Reverse Engineer Error #1163

Closed
opened 2026-01-22 13:04:28 +01:00 by admin · 4 comments
Owner

Originally created by @doctrinebot on GitHub (Dec 15, 2010).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user jreed:

Following the instructions in the documentation for reverse engineering a database causes an error. It works fine in Doctrine 2 Beta 4 but broke in RC1 and is still an issue in RC2. Executing the following code:

$em->getConfiguration()->setMetadataDriverImpl(
new \Doctrine\ORM\Mapping\Driver\DatabaseDriver(
$em->getConnection()->getSchemaManager()
));

$em->getConfiguration()->setEntityNamespaces(array('MyCompany\Model'));

$cmf = new \Doctrine\ORM\Tools\DisconnectedClassMetadataFactory($em);
$metadata = $cmf->getAllMetadata();

Generates this error:
Fatal error: Call to a member function getConfiguration() on a non-object in D:\dev\win\src\library\doctrine-orm\Doctrine\ORM\Mapping\ClassMetadataFactory.php on line 135

The error occurs when executing DisconnectedClassMetadataFactory::getAllMetadata()

Originally created by @doctrinebot on GitHub (Dec 15, 2010). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user jreed: Following the instructions in the documentation for reverse engineering a database causes an error. It works fine in Doctrine 2 Beta 4 but broke in RC1 and is still an issue in RC2. Executing the following code: $em->getConfiguration()->setMetadataDriverImpl( new \Doctrine\ORM\Mapping\Driver\DatabaseDriver( $em->getConnection()->getSchemaManager() )); $em->getConfiguration()->setEntityNamespaces(array('MyCompany\Model')); $cmf = new \Doctrine\ORM\Tools\DisconnectedClassMetadataFactory($em); $metadata = $cmf->getAllMetadata(); Generates this error: Fatal error: Call to a member function getConfiguration() on a non-object in D:\dev\win\src\library\doctrine-orm\Doctrine\ORM\Mapping\ClassMetadataFactory.php on line 135 The error occurs when executing DisconnectedClassMetadataFactory::getAllMetadata()
admin added the Bug label 2026-01-22 13:04:28 +01:00
admin closed this issue 2026-01-22 13:04:29 +01:00
Author
Owner

@doctrinebot commented on GitHub (Dec 15, 2010):

Comment created by @beberlei:

Ah this is a doc error.

Code must be:

$cmf = new \Doctrine\ORM\Tools\DisconnectedClassMetadataFactory();
$cmf->setEntityManager($em);
$metadata = $cmf->getAllMetadata();
@doctrinebot commented on GitHub (Dec 15, 2010): Comment created by @beberlei: Ah this is a doc error. Code must be: ``` $cmf = new \Doctrine\ORM\Tools\DisconnectedClassMetadataFactory(); $cmf->setEntityManager($em); $metadata = $cmf->getAllMetadata(); ```
Author
Owner

@doctrinebot commented on GitHub (Dec 18, 2010):

Comment created by @beberlei:

fixed

@doctrinebot commented on GitHub (Dec 18, 2010): Comment created by @beberlei: fixed
Author
Owner

@doctrinebot commented on GitHub (Dec 18, 2010):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Dec 18, 2010): Issue was closed with resolution "Fixed"
Author
Owner

@doctrinebot commented on GitHub (Dec 29, 2010):

Comment created by netinho:

Hello,

On documentation of doctrine-orm 2.0:

$em->getConfiguration()->setMetadataDriverImpl(
    new \Doctrine\ORM\Mapping\Driver\DatabaseDriver(
        $em->getConnection()->getSchemaManager()
    )
);

$cmf = new DisconnectedClassMetadataFactory($em);
$metadata = $cmf->getAllMetadata();

I replaced and is working with

$em->getConfiguration()->setMetadataDriverImpl(
    new \Doctrine\ORM\Mapping\Driver\DatabaseDriver(
        $em->getConnection()->getSchemaManager()
    )
);

$cmf = new \Doctrine\ORM\Tools\DisconnectedClassMetadataFactory();
$cmf->setEntityManager($em);
$metadata = $cmf->getAllMetadata();

Please, if this way is the correct, update the documentation.

Thank you!

@doctrinebot commented on GitHub (Dec 29, 2010): Comment created by netinho: Hello, On [documentation of doctrine-orm 2.0](http://www.doctrine-project.org/docs/orm/2.0/en/reference/tools.html#reverse-engineering): ``` $em->getConfiguration()->setMetadataDriverImpl( new \Doctrine\ORM\Mapping\Driver\DatabaseDriver( $em->getConnection()->getSchemaManager() ) ); $cmf = new DisconnectedClassMetadataFactory($em); $metadata = $cmf->getAllMetadata(); ``` I replaced and is working with ``` $em->getConfiguration()->setMetadataDriverImpl( new \Doctrine\ORM\Mapping\Driver\DatabaseDriver( $em->getConnection()->getSchemaManager() ) ); $cmf = new \Doctrine\ORM\Tools\DisconnectedClassMetadataFactory(); $cmf->setEntityManager($em); $metadata = $cmf->getAllMetadata(); ``` Please, if this way is the correct, update the documentation. Thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1163