-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Description
Symfony version(s) affected
5.4.x
Description
Hello
The upgrade from Symfony 5.3.x to Symfony 5.4.x led to multiple MappingException in one of my project.
From what I could investigate, I think that this commit could be at the origin of - what I consider being a - BC Break as it changes the default value of mapping type from "annotation" to "attribute" in the following use case.
What I describe below is working properly in Symfony 5.3.x.
How to reproduce
I'm on a legacy project separated into bundles.
One of that bundle provides an embeddable class in an Entity folder.
namespace App\FooBundle\Entity;
/**
* @ORM\Embeddable
*/
class Foo
{
}App\FooBundle\Entity, only the embeddable.
Then Another bundle contains an entity using that embeddable
namespace App\BarBundle\Entity;
/**
* @ORM\Entity
*/
class Bar
{
/**
* @ORM\Embedded(class="App\FooBundle\Entity\Foo")
*
* @var Foo
*/
protected $foo;
}and the doctrine configuration is the following:
# config/packages/doctrine.yaml
orm:
auto_mapping: true
# "mappings" key is not definedPossible Solution
The solution I found is to explicitly define the mapping type in doctrine configuration
# config/packages/doctrine.yaml
orm:
mappings:
AppFooBundle:
is_bundle: true
type: annotationI don't know if any change has to be done regarding the code itself, maybe it requires an additional row in this part of the upgrade documentation.
Additional Context
No response