-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
EntityManager decorator #22
Conversation
Thank you. I would prefer to release v0.2 and after all, drop EntityManager and introduce only decorator. Do you agree? |
Yes, I have not problem with it |
src/EntityManager.php
Outdated
|
||
class EntityManager extends DoctrineEntityManager | ||
class EntityManager extends EntityManagerDecorator implements IEntityManager |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we rename it to EntityManagerDecorator and drop implements?
src/DI/OrmExtension.php
Outdated
|
||
// Entity Manager | ||
$builder->addDefinition($this->prefix('entityManager')) | ||
->setFactory($entityManagerClass, [$original]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it still needed? Could we drop it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's EntityManagerDecorator registration
src/DI/OrmExtension.php
Outdated
@@ -19,7 +19,7 @@ | |||
|
|||
/** @var mixed[] */ | |||
private $defaults = [ | |||
'entityManagerClass' => EntityManager::class, | |||
'entityManagerClass' => EntityManagerDecorator::class, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about:
entityManagerDecoratorClass
decoratorClass
decorator
$builder->addDefinition($this->prefix('entityManager')) | ||
->setType($entityManagerClass) | ||
->setFactory(EntityManagerFactory::class . '::create', [ | ||
$original = $builder->addDefinition($this->prefix('entityManager')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we drop entityManager, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's needed for decorator.
|
||
class DummyEntityManager extends EntityManager | ||
class DummyEntityManager extends EntityManagerDecorator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DummyEntityManagerDecorator
I think it's done. What do you think @MartkCz? |
I agree |
One last thing, we should add some note/example into readme. How people should you EntityManager (over EntityManagerDecorator). Could you pleasae @MartkCz? |
Maybe rename section EntityManager -> EntityManagerDecorator? I'm not sure, |
Definitely. |
Sorry for delay, I will try to test it as soon as possible. |
Done. :-) Thanks. |
Hi, i am very unhappy about this PR as it caused BC break on many of our projects - we are using |
We can change signiture for this class. Or you can do also. |
Sorry i am not sure i understand what do you mean. So far we have fixed it by replacing |
If someone use Doctrine\ORM\EntityManager instead of Nettrine\ORM\EntityManager type hint it's BC break. I can add workaround to OrmExtension