Skip to content

Cannot create Doctrine\ORMEntityManager instance, inheritance error. #10184

@Vitsen15

Description

@Vitsen15

Bug Report

Q A
BC Break no
Version 2.13
PHP version 7.1.27

composer.json content:

"require": {
...
"doctrine/dbal": "^2.13",
"doctrine/orm": "^2.13",
"symfony/cache": "^4.4",
"symfony/var-dumper": "4.4.47",
"doctrine/annotations": "^1.13",
...
},

Summary

Getting Inheritance error when trying to create entity manager:

EntityManager::create($connection, $config);

Current behavior

When I'm trying to create EntityManager instance, I get the next error:

Declaration of Doctrine\ORM\Proxy\ProxyFactory::skipClass(Doctrine\Persistence\Mapping\ClassMetadata $metadata) must be compatible with Doctrine\Common\Proxy\AbstractProxyFactory::skipClass(Doctrine\Common\Persistence\Mapping\ClassMetadata $metadata)

How to reproduce

Create \Doctrine\ORM\Configuration object instance:

$cache = new FilesystemAdapter('rest');
$entitiesPaths = ['path/to/entities'];
$config = ORMSetup::createAnnotationMetadataConfiguration($entitiesPaths, $isDevMode);
$config->setResultCache($cache);

Then creating the \Doctrine\DBAL\Connection:

$connection = DriverManager::getConnection([
                'wrapperClass' => PrimaryReadReplicaConnection::class,
                'driver' => 'pdo_mysql',
                'keepReplica' => true,
                'primary' => [
                    'user' => $config->get('master.username'),
                    'host' => $config->get('master.hostname'),
                    'password' => $config->get('master.password'),
                    'dbname' => 'db',
                ],
                'replica' => [
                    [
                        'user' => $config->get('slave.username'),
                        'host' => $config->get('slave.hostname'),
                        'password' => $config->get('slave.password'),
                        'dbname' => 'db',
                    ]
                ]
            ]
        );

And to create Doctrine\ORMEntityManager instance:

$entityManager = EntityManager::create($connection, $config);

After this, error is occurred.

Expected behaviour

Doctrine\ORMEntityManager to be created.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions