DDC-2170: Decorator base classes for query related objects #2862

Open
doctrinebot opened this Issue Nov 26, 2012 · 5 comments

2 participants

@doctrinebot

Jira issue originally created by user lstrojny:

Doctrine\ORM\Query should not be directly extendable but it would be nice to decorate query objects and add additional methods. Use cases are e.g. doctrine-fun (see https://github.com/lstrojny/doctrine-fun/blob/master/src/Doctrine/Fun/Query.php) or even cases where users want to add domain specific methods. As Doctrine\ORM\Query is final it is not so easy to decorate correctly. I would propose:

  • Add a new interfaces: Doctrine\ORM\QueryInterface that provides a contract for all methods Doctrine\ORM\Query provides
  • Add a decorator base class Doctrine\ORM\QueryDecorator as an extension point
  • Some for NativeQuery and QueryBuilder
@doctrinebot

Comment created by lstrojny:

Related:

@doctrinebot

Comment created by gcds:

Any changes on this?

@doctrinebot

Comment created by @ocramius:

The EntityManagerInterface now allows producing custom query objects: just requires a custom createQuery or createQueryBuilder API.

@doctrinebot

Comment created by gcds:

Yes, but you can't extend Doctrine\ORM\Query object, and many places expects Doctrine\ORM\Query not your custom query object

@doctrinebot

Comment created by @ocramius:

Oh, I see what you mean.

Yes, those still require patching, so I suggest getting your hands dirty and trying with a pull request ;-)

@Ocramius Ocramius was assigned by doctrinebot Dec 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment