Skip to content


DDC-817: Repository Query by associated ID #5335

doctrinebot opened this Issue · 3 comments

2 participants


Jira issue originally created by user @beberlei:

The DDC-117 already has an implementation for this. We need a way to use the EntityRepository to query by foreign key or the related object instance.

This should be in 2.0


Comment created by @beberlei:

Implemented, you can now do repository queries like:

$post = $em->getRepository('Post')->findByCategory($categoryId);

This does however NOT allow something like the following:

$post = $em->getRepository('Post')->findByCategory($category);

with $category being an instance of the entity. Only lookups per key are allowed.

It also obviously only works on the owning side of an association.


Issue was closed with resolution "Fixed"

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.0-RC1 milestone
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.