Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in doctrine/orm 2.8.2 affects console commands #89

Open
jankonas opened this issue Feb 21, 2021 · 3 comments
Open

Bug in doctrine/orm 2.8.2 affects console commands #89

jankonas opened this issue Feb 21, 2021 · 3 comments

Comments

@jankonas
Copy link
Contributor

There was a BC-break introduced in doctrine/orm 2.8.2 - AbstractCommand requires EntityManager: doctrine/orm#8488.

When running db-related commands, following error is thrown:

ErrorException: assert(): assert($em instanceof EntityManager) failed in vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/AbstractCommand.php:56

It is already fixed (doctrine/orm#8493), so I assume 2.8.3 will be ok.

Maybe it would be worth it to add conflict with 2.8.2 into composer.json?

@f3l1x
Copy link
Member

f3l1x commented Feb 21, 2021

Great report. Will you prepare PR?

@petrparolek
Copy link
Contributor

Is good idea make workaround for bug?

@redwormik
Copy link

redwormik commented Mar 17, 2021

@petrparolek I found a workaround, but it is not very nice (and possibly breaks if you use entityManagerHelper and depend on your EntityManagerDecorator in custom commands).

  1. Create a new EntityManagerDecorator (or add getWrapped method to it):
class MyEntityManagerDecorator extends Nettrine\ORM\EntityManagerDecorator
{
	public function getWrapped(): Doctrine\ORM\EntityManagerInterface
	{
		return $this->wrapped;
	}
}
  1. Use it in config and use wrapped EntityManager in entityManagerHelper:
nettrine.orm:
	entityManagerDecoratorClass: MyEntityManagerDecorator

services:
	nettrine.orm.console.entityManagerHelper:
		arguments:
			- @nettrine.orm.entityManagerDecorator::getWrapped()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants