Closed Narretz closed 11 years ago
Regarding the singular/plural form of words, I left a comment in https://github.com/doctrine/doctrine2/commit/5cdb0ae8beaf29d924f0362341d4965cca0f1dbe#commitcomment-2602042.
I'll tend to the rest of this PR now, though.
I copied over the ORM implementation. You may find issues with improper plural => singular conversions, which I suppose can be manually corrected in the generated code.
@jwage: I don't think there's any reason to generate a setX()
method here, is there? addX()
and removeX()
certainly play nicer with change-tracking.
In Doctrine\ODM\MongoDB\Tools\DocumentGenerator->generateDocumentStubMethods generates adders, getters and setters based on the type of field reference. For (@ MongoDB\ReferenceMany) , it generates an adder and a getter,
while Doctrine\ORM\Tools\EntityGenerator generates an adder, remover and getter:
It also singularizes the field name, which the ODM does not.
This is okay. When I use it together with Symfony 2.1.8 and I have the referenced documents in a collection FormType that I try to update. I get the following exception:
You can then either create a setter, or make the adder singular and add a remover, then it works.
Is there a reason this is different from the ORM or is this a bug?