My entity has a loadMetadata method and all should be fine.
Error
However, if I try to run any command that use the default entity manager service, I got the following error:
Symfony\Component\ErrorHandler\Error\ClassNotFoundError^ {#4743
#message: """
Attempted to load class "StaticPHPDriver" from namespace "Doctrine\ORM\Mapping\Driver".\n
Did you forget a "use" statement for "Doctrine\Persistence\Mapping\Driver\StaticPHPDriver"?
"""
#code: 0
#file: "./var/cache/dev/ContainerJ7M0HEC/getDoctrine_Orm_DefaultEntityManagerService.php"
#line: 52
Issue
Digging dipper and it appear that the generated class has this line:
I tried to patch the generated class and run, for example, doctrine:schema:update --dump-sql and it works.
Proposal
My suggestion would be to patch the file config/orm.xml and replace the value of parameter with key doctrine.orm.metadata.staticphp.class with \Doctrine\Persistence\Mapping\Driver\StaticPHPDriver.
Context
I'm trying to setup a static php mapping with the following configuration (truncate with unrelated configuration):
My entity has a
loadMetadata
method and all should be fine.Error
However, if I try to run any command that use the default entity manager service, I got the following error:
Issue
Digging dipper and it appear that the generated class has this line:
The class
\Doctrine\ORM\Mapping\Driver\StaticPHPDriver
has been removed from doctrine/orm since v3.0 and deprecated since v2.3.But the corrected line would be (I guess):
I tried to patch the generated class and run, for example,
doctrine:schema:update --dump-sql
and it works.Proposal
My suggestion would be to patch the file
config/orm.xml
and replace the value of parameter with keydoctrine.orm.metadata.staticphp.class
with\Doctrine\Persistence\Mapping\Driver\StaticPHPDriver
.