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

Prepare field's value for references #1363

Closed
wants to merge 2 commits into from

Conversation

malarzm
Copy link
Member

@malarzm malarzm commented Feb 14, 2016

This is a subset of ODM preparing query according to field's mapping, but as it's bigger thing here's small part that is cool enough to make its way to 1.1 already - now one can query for references without using query builder! It even doesn't matter if reference is one or many, simple or not:

$dm->getRepository(User::class)->findOneBy(['account' => $account]);
$dm->getRepository(User::class)->findBy(['groups' => $group]);

Additionally to being nice it should fix doctrine/DoctrineMongoDBBundle#208 and close #292 :)

@alcaeus
Copy link
Member

alcaeus commented Feb 14, 2016

Wow, so simple one could ask why we haven't thought of this before. Does this also work in query builder or does that still have to go through reference?

$queryBuilder
    ->field('account')
    ->equals($account);

@malarzm
Copy link
Member Author

malarzm commented Feb 14, 2016

Should work already, but won't be as smart as references after #1333 and I'm not sure yet whether it should :)

@alcaeus
Copy link
Member

alcaeus commented Feb 14, 2016

👍 Sounds good!

malarzm added a commit that referenced this pull request Feb 20, 2016
@malarzm
Copy link
Member Author

malarzm commented Feb 20, 2016

Merged manually in fbbe096

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

Successfully merging this pull request may close these issues.

Unique Constraint in reference only works with simple references findBySomething($object) doesn't work
2 participants