Doctrine Entities in a custom database (Error in overwriting EntityManager)

Permalink
Hello, world!


I was messing around with the example in the following documentation article:
(https://documentation.concrete5.org/developers/packages/custom-database-tables-in-packages/doctrine-entities-in-a-custom-database)

This is a really cool feature but it seems that it didn't worked for me.
When i try to create the new Instance of MyEntityManager in my package controller (as you see below or check chapter "Initialize your own Entity Manager" in documentation article)
$entityManager = new \**MyNamespace**\MyEntityManager($connection, $ormConfiguration, $connection->getEventManager());

I get the following error:
Call to protected Doctrine\ORM\EntityManager::__construct() from context 'Concrete\Package\**MyPackageName**\Controller'.

I know that the constructor of EntityManager is protected and I wonder how can i bypass this or am i missing something?

dimger84