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

EntityManager decorator #22

Merged
merged 8 commits into from
Nov 2, 2018
Merged

EntityManager decorator #22

merged 8 commits into from
Nov 2, 2018

Conversation

MartkCz
Copy link
Member

@MartkCz MartkCz commented Jun 14, 2018

If someone use Doctrine\ORM\EntityManager instead of Nettrine\ORM\EntityManager type hint it's BC break. I can add workaround to OrmExtension

@f3l1x
Copy link
Member

f3l1x commented Jun 14, 2018

Thank you. I would prefer to release v0.2 and after all, drop EntityManager and introduce only decorator. Do you agree?

@MartkCz
Copy link
Member Author

MartkCz commented Jun 15, 2018

Yes, I have not problem with it


class EntityManager extends DoctrineEntityManager
class EntityManager extends EntityManagerDecorator implements IEntityManager
Copy link
Member

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?


// Entity Manager
$builder->addDefinition($this->prefix('entityManager'))
->setFactory($entityManagerClass, [$original]);
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's EntityManagerDecorator registration

@@ -19,7 +19,7 @@

/** @var mixed[] */
private $defaults = [
'entityManagerClass' => EntityManager::class,
'entityManagerClass' => EntityManagerDecorator::class,
Copy link
Member

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'))
Copy link
Member

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see.

Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DummyEntityManagerDecorator

@f3l1x
Copy link
Member

f3l1x commented Jun 18, 2018

I think it's done. What do you think @MartkCz?

@MartkCz
Copy link
Member Author

MartkCz commented Jun 18, 2018

I agree

@f3l1x
Copy link
Member

f3l1x commented Jun 28, 2018

One last thing, we should add some note/example into readme. How people should you EntityManager (over EntityManagerDecorator).

Could you pleasae @MartkCz?

@MartkCz
Copy link
Member Author

MartkCz commented Jun 28, 2018

Maybe rename section EntityManager -> EntityManagerDecorator? I'm not sure,

@f3l1x
Copy link
Member

f3l1x commented Jun 28, 2018

Definitely.

@f3l1x
Copy link
Member

f3l1x commented Jul 19, 2018

Sorry for delay, I will try to test it as soon as possible.

@f3l1x f3l1x added this to the v0.3 milestone Nov 2, 2018
@f3l1x f3l1x merged commit d4c006e into contributte:master Nov 2, 2018
@f3l1x
Copy link
Member

f3l1x commented Nov 2, 2018

Done. :-) Thanks.

@JanMikes
Copy link
Contributor

Hi, i am very unhappy about this PR as it caused BC break on many of our projects - we are using Doctrine\ORM\EntityManager for our dependencies instead of Nettrine\ORM\EntityManager which i consider to be better.

@f3l1x
Copy link
Member

f3l1x commented Nov 21, 2018

We can change signiture for this class. Or you can do also.

@JanMikes
Copy link
Contributor

Sorry i am not sure i understand what do you mean.

So far we have fixed it by replacing Doctrine\ORM\EntityManager with Doctrine\ORM\EntityManagerInterface which is most probably the best practice.

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

Successfully merging this pull request may close these issues.

3 participants