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

Unique constraint (from DoctrineMongoDBBundle) doesn't work with embedded document #295

Closed
pierrre opened this issue Apr 26, 2012 · 10 comments
Assignees

Comments

@pierrre
Copy link

pierrre commented Apr 26, 2012

I'm trying to use the "unique validator" from the DoctrineMongoDBBundle, but I get this error:
[BadMethodCallException] Doctrine\ODM\MongoDB\Mapping\ClassMetadataInfo::getAssociationTargetClass($assocName) is not implemented yet.

Am I doing something wrong?

I use Symfony 2.1, and latest bundles/projects versions.

@pierrre
Copy link
Author

pierrre commented Apr 26, 2012

I have more details on this problem:

  • "unique" constraint works with a "normal" document
  • "unique" constraint doesn't work with an embedded document

@jmikola
Copy link
Member

jmikola commented Apr 27, 2012

Cross-linking: doctrine/DoctrineMongoDBBundle#97

The validator itself looks fine. We likely just need to implement this method (and others if possible) to support the use case.

@pierrre
Copy link
Author

pierrre commented Apr 27, 2012

I have a small question: does it make sense to have an "unique" constraint on an embedded document?

@jmikola
Copy link
Member

jmikola commented Apr 28, 2012

I think it's possible to define a unique index on an embedded document, which should get picked up when the concrete document (corresponding to a collection) determines its indexes. In that sense, I think it's reasonable for embedded documents to also define unique constraints for those fields.

@ghost ghost assigned jmikola May 18, 2012
@pierrre
Copy link
Author

pierrre commented Sep 26, 2012

The real problem is: we can't use the "unique" constraint on a field with an "association" (reference or embed).
Do you think it's easy to implement?

@peshi
Copy link
Contributor

peshi commented Oct 30, 2012

@jwage ping
I'm asking the same questions, will this get looked at soon?
#97

@davidloubere
Copy link

Issue looks still relevant early 2016.
Can we have a status please?

@malarzm
Copy link
Member

malarzm commented Jan 22, 2016

@davidloubere: as denoted by label status is "needs test" - please feel free to create a failing unit test and submit is a PR, this will speed up working on the issue

@malarzm
Copy link
Member

malarzm commented Feb 14, 2016

According to my tests from #1363 DocumentRepository::findBy() already accepted embedded documents and was working properly - call for tests is still open

@alcaeus
Copy link
Member

alcaeus commented Dec 22, 2017

Closing - if anyone can provide a failing test case, please do.

@alcaeus alcaeus closed this as completed Dec 22, 2017
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants