platform icon indicating copy to clipboard operation
platform copied to clipboard

Doctrine metadata inconsistencies

Open vytsci opened this issue 5 years ago • 1 comments

Summary
We have faced an issue where oro:migration:load fails if for example you inject huge service like ActivityManager into one of you commands. Somehow creation of ActivityManager service gets metadata warmed up without entity extend thingies.

Steps to reproduce
Create any command and inject ActivityManager into it via DI.

Actual Result Entity extend config and cache warmup ends up failing, because somehow doctrine throws errors while registering symfony commands. We havent dig deep enough to know exact bug. Whole log were full of errors of missing fields in example Comment entity missing attachment field and Email entity missing user_d41b1c4b, and those are specifically entity extend fields and they were present inside proxy classes at all times.

Expected Result
Migrations should work fine in such cases, otherwise everything is unstable.

Details about your environment

  • OroPlatform version: 3.1.19
  • PHP version: 7.2.25
  • Database: MySql 5.7

Additional information
We had issues until we removed ActivityManager from our commands, after we removed ActivityManager service everything went back to normal. This is very strange issue, but I think we should report in case someone ends up with similar issue.

vytsci avatar Mar 03 '20 18:03 vytsci

You can declare the command that uses ActivityManager as lazy. See https://symfony.com/doc/4.4/console/commands_as_services.html#lazy-loading So it will not affect other commands.

anyt avatar Mar 03 '20 18:03 anyt