mirror of
https://github.com/doctrine/orm.git
synced 2026-04-29 01:13:14 +02:00
DDC-2287: Getter/Setter: generate "isEnabled()" instead of "getEnabled()" for boolean field in entity classes #2873
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?
Originally created by @doctrinebot on GitHub (Feb 8, 2013).
Originally assigned to: @Majkl578 on GitHub.
Jira issue originally created by user sukhrob:
It would be better if doctrine generated "isEnabled()" instead of "getEnabled()" for boolean field in entity classes. Because, it is more meaningful.
@doctrinebot commented on GitHub (Feb 8, 2013):
@doctrinebot commented on GitHub (Feb 8, 2013):
Comment created by @ocramius:
Not sure this kind of check should be handled. Starting to add all this kind of rules makes me think that it is becoming a big ball of mud
@doctrinebot commented on GitHub (Oct 31, 2014):
Comment created by jthijssen2:
I agree that it would be hard to figure out which prefix to use (isEnabled() or hasEnabled() are both valid, depending on context).
However, it might be easy enough to check for a is or has method already present inside the entity, (https://github.com/doctrine/doctrine2/blob/f12c311a795b69a5f4853b079b3f8ad2c9867181/lib/Doctrine/ORM/Tools/EntityGenerator.php#L1360). If present, we could skip creating the getter as well.
This allows to (manually) change the getEnabled() into an isEnabled(), and future generations will not add the getEnabled() anymore.
It also makes it easier to confirm to PMD's booleanGetMethodName rule (http://phpmd.org/rules/naming.html#booleangetmethodname)
@doctrinebot commented on GitHub (Nov 10, 2014):
Comment created by @ocramius:
Getting back to this, I don't think we should alter codegen based on DBAL types, as per previous discussions in DDC-2924.
We're trying to decouple code generation from that, while this sort of approach increases coupling.
I'm inclined to reject the proposal until we split out the code generator into its own component.
@Majkl578 commented on GitHub (Dec 19, 2017):
Closing, codegen to be removed in Doctrine 3.0.