mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
[PR #5733] Don't singularize TO_MANY field's variable names if target entity name is plural #9710
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/doctrine/orm/pull/5733
State: closed
Merged: No
According to this stackoverflow question, the
Doctrine\ORM\Tools\EntityGeneratorsingularises the variables & methods names foraddandremovesetters and their parameters, forT0_MANYassociations.Example for a target entity called
Dnis.The expected result would be to have the
getDnis(),addDnis(Dnis $dnis)andremoveDnis(Dnis $dnis)methods generated.But we would have
getDnis(),addDni(Dnis $dni)andremoveDni(Dnis $dni), that gives names that are not corresponding with the real target entity name.I just added a small check that avoids calling
Inflector::singularize($variableName|$methodName)foradd+removeif the target entity name ends bys.I also updated the test with the example I given.
I don't see any side effects for now, let me know if this breaks something, or if I can make improvements.
Thank's