Decorator base class for object manager decorators #229

Merged
merged 1 commit into from Jan 20, 2013

Conversation

Projects
None yet
6 participants
@lstrojny
Contributor

lstrojny commented Nov 25, 2012

As discussed on IRC, the first PR for decorator base classes. This time for ObjectManager.

@doctrinebot

This comment has been minimized.

Show comment
Hide comment
@doctrinebot

doctrinebot Nov 25, 2012

Hello,

thank you for positing this Pull Request. I have automatically opened an issue on our Jira Bug Tracker for you with the details of this Pull-Request. See the Link:

http://doctrine-project.org/jira/browse/DCOM-148

Hello,

thank you for positing this Pull Request. I have automatically opened an issue on our Jira Bug Tracker for you with the details of this Pull-Request. See the Link:

http://doctrine-project.org/jira/browse/DCOM-148

@guilhermeblanco

This comment has been minimized.

Show comment
Hide comment
@guilhermeblanco

guilhermeblanco Nov 26, 2012

Member

Sorry, but I don't any direct value to Doctrine project.
It may be only me, but we strongly avoid creating support that brings more maintenance, more burden to this project.
Also, it does not directly affect Doctrine, consider this as not part of Core.

Member

guilhermeblanco commented Nov 26, 2012

Sorry, but I don't any direct value to Doctrine project.
It may be only me, but we strongly avoid creating support that brings more maintenance, more burden to this project.
Also, it does not directly affect Doctrine, consider this as not part of Core.

@lstrojny

This comment has been minimized.

Show comment
Hide comment
@lstrojny

lstrojny Nov 26, 2012

Contributor

@guilhermeblanco While I would argue that it is crucial for Doctrine to provide well defined extension points for central classes like EntityManager, I can see your point. On a sitenote: having decorator infrastructure in Doctrine itself means that it can be supported quite nicely (add support for it via Doctrine\ORM\Configuration, extending the SF2 DoctrineBundle to support it and so on).

An alternative would be to add interfaces and setEntityManagermethods for at least the following classes:

  • Doctrine\ORM\EntityManager
  • Doctrine\ORM\Query
  • Doctrine\ORM\QueryBuilder

Than a third party bundle could add decorator support. Let me know what you think.

Contributor

lstrojny commented Nov 26, 2012

@guilhermeblanco While I would argue that it is crucial for Doctrine to provide well defined extension points for central classes like EntityManager, I can see your point. On a sitenote: having decorator infrastructure in Doctrine itself means that it can be supported quite nicely (add support for it via Doctrine\ORM\Configuration, extending the SF2 DoctrineBundle to support it and so on).

An alternative would be to add interfaces and setEntityManagermethods for at least the following classes:

  • Doctrine\ORM\EntityManager
  • Doctrine\ORM\Query
  • Doctrine\ORM\QueryBuilder

Than a third party bundle could add decorator support. Let me know what you think.

@schmittjoh

This comment has been minimized.

Show comment
Hide comment
@schmittjoh

schmittjoh Nov 26, 2012

Member

If you plan to decorate the entity manager, you'll probably need to write a
decorator for it directly as it has a lot more methods than the
ObjectManager interface.

On Mon, Nov 26, 2012 at 9:23 AM, Lars Strojny notifications@github.comwrote:

@guilhermeblanco https://github.com/guilhermeblanco While I would argue
that it is crucial for Doctrine to provide well defined extension points
for central classes like EntityManager, I can see your point. On a
sitenote: having decorator infrastructure in Doctrine itself means that it
can be supported quite nicely (add support for it via
Doctrine\ORM\Configuration, extending the SF2 DoctrineBundle to support
it and so on).

An alternative would be to add interfaces and setEntityManagermethods for
at least the following classes:

  • Doctrine\ORM\EntityManager
  • Doctrine\ORM\Query
  • Doctrine\ORM\QueryBuilder

Than a third party bundle could add decorator support. Let me know what
you think.


Reply to this email directly or view it on GitHubhttps://github.com/doctrine/common/pull/229#issuecomment-10707722.

Member

schmittjoh commented Nov 26, 2012

If you plan to decorate the entity manager, you'll probably need to write a
decorator for it directly as it has a lot more methods than the
ObjectManager interface.

On Mon, Nov 26, 2012 at 9:23 AM, Lars Strojny notifications@github.comwrote:

@guilhermeblanco https://github.com/guilhermeblanco While I would argue
that it is crucial for Doctrine to provide well defined extension points
for central classes like EntityManager, I can see your point. On a
sitenote: having decorator infrastructure in Doctrine itself means that it
can be supported quite nicely (add support for it via
Doctrine\ORM\Configuration, extending the SF2 DoctrineBundle to support
it and so on).

An alternative would be to add interfaces and setEntityManagermethods for
at least the following classes:

  • Doctrine\ORM\EntityManager
  • Doctrine\ORM\Query
  • Doctrine\ORM\QueryBuilder

Than a third party bundle could add decorator support. Let me know what
you think.


Reply to this email directly or view it on GitHubhttps://github.com/doctrine/common/pull/229#issuecomment-10707722.

@beberlei

This comment has been minimized.

Show comment
Hide comment
@beberlei

beberlei Nov 26, 2012

Member

@guilhermeblanco We have been telling people that extending the EM should be done through decoration, yet we haven't provided this decorator base for now, making this process unnecessarily hard for users.

Member

beberlei commented Nov 26, 2012

@guilhermeblanco We have been telling people that extending the EM should be done through decoration, yet we haven't provided this decorator base for now, making this process unnecessarily hard for users.

@lstrojny

This comment has been minimized.

Show comment
Hide comment
@lstrojny

lstrojny Nov 26, 2012

Contributor
@stof

This comment has been minimized.

Show comment
Hide comment
@stof

stof Nov 26, 2012

Member

@beberlei see my comment on the ORM pull request. Using composition does not work in all places as the ORM injects itself in other places (which will not inject the decorator)

Member

stof commented Nov 26, 2012

@beberlei see my comment on the ORM pull request. Using composition does not work in all places as the ORM injects itself in other places (which will not inject the decorator)

@beberlei

This comment has been minimized.

Show comment
Hide comment
@beberlei

beberlei Nov 26, 2012

Member

@stof yes for the EntityRepository you can create a decorator as well to fix that, however for the Event API there is no solution. But i guess that can be documented and accepted

Member

beberlei commented Nov 26, 2012

@stof yes for the EntityRepository you can create a decorator as well to fix that, however for the Event API there is no solution. But i guess that can be documented and accepted

beberlei added a commit that referenced this pull request Jan 20, 2013

Merge pull request #229 from lstrojny/feature/object-manager-decorator
Decorator base class for object manager decorators

@beberlei beberlei merged commit f44d98d into doctrine:master Jan 20, 2013

1 check passed

default The Travis build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment