mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Formapro\Pvm\Doctrine\DoctrineDAL::__construct() must be an instance of Doctrine\Common\Persistence\ObjectManager, instance of Doctrine\ORM\EntityManager given #6521
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @whittlem on GitHub (Aug 14, 2020).
I'm trying to get Formapro PVM working with Doctrine.
The error message I am getting is:
According to the documentation example I'm supposed to be passing EntityManager as the first argument:
$doctrineDal = new DoctrineDAL($entityManager, OrmProcess::class, OrmToken::class);The error message above seems to suggest this should be ObjectManager now and I'm not sure how to upgrade this. It does not look like ObjectManager has a "create" method.
The current relevant code looks like this:
In Doctrine how do I create the ObjectManager instead of EntityManager to pass to:
$doctrineDal = new DoctrineDAL($objectManager, OrmProcess::class, OrmToken::class);The versions I'm using in composer are:
@SenseException commented on GitHub (Aug 14, 2020):
Which version of ORM and Persistence are installed in your project?
^2.6.2can be a wide range of versions (see composer docs).You might take a look at the library where
Formapro\Pvm\Doctrine\DoctrineDALis used. Doctrine Persistence was moved from Common into its own repository and your project's dependencies probably don't fit together.@whittlem commented on GitHub (Aug 17, 2020):
Thanks for the reply.
The issue I have is that DoctrineDAL is expecting ObjectManager as the first argument and all the documentation says it should be EntityManager. I'm not sure how to create that ObjectManager instance to pass it. I've sort of run out of options now and I can't seem to find a solution online.
@whittlem commented on GitHub (Aug 17, 2020):
Composer won't actually let me downgrade to doctrine/orm:^2.6 as per https://pvm-demo.forma-pro.com/demo/store-to-mysql
According to this https://www.doctrine-project.org/projects/orm.html, 2.7.3 is stable and anything lower is not maintained. So I guess I am committed to making this work. I just need help to find out how to create the DoctrineDAL using an ObjectManager rather than an EntityManager.
@mxmp210 commented on GitHub (Sep 14, 2020):
To anyone getting stuck with this,
Just use "doctrine/common":"^2.13" till package is upgraded along with whole eco-system and gets full compatibility.
It installed orm version 2.7.3 which is stable release at the moment of writing. took me a quite while to figure out why packages aren't in sync even in LTS / stable channel.
For Search Optimization I'm quoting FOSUserBundle exception as well :