Skip to content

Bug : Entity retrieved from an injected Repository in a Symfony Service is detached. This bug occurs with the following conditions: - Version of doctrine/doctrine-bundle version >= 1.6.4 - the Entity has an attached EntityListener - The Service is injected into the EntityListener

License

Notifications You must be signed in to change notification settings

sebblanc/debug-symfony-3-4-unexpected-doctrine-entity-state-in-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

I made this project to show how to obtain the bug that I'm talking about in the following StackOverflow post

This bug occurs from doctrine/doctrine-bundle v1.6.4 : doctrine.orm.entity_manager.abstract as lazy

To run the project just clone it and install the vendors, then follow the instructions below in dev env

Create the DB if it's not done yet

php bin/console doctrine:database:create

Populate the DB with some test data

php bin/console doctrine:fixtures:load --purge-with-truncate

Open /web/app_dev.php, you'll get the following result:

State of $superEntity is 3 and should be 1

Change the version of doctrine/doctrine-bundle to 1.6.3 in composer.json

Open /web/app_dev.php, you'll get the following result:

State of $superEntity is 1 and should be 1

About

Bug : Entity retrieved from an injected Repository in a Symfony Service is detached. This bug occurs with the following conditions: - Version of doctrine/doctrine-bundle version >= 1.6.4 - the Entity has an attached EntityListener - The Service is injected into the EntityListener

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages