mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-3087: Entity code generation skip setters #3833
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 (Apr 15, 2014).
Originally assigned to: @Majkl578 on GitHub.
Jira issue originally created by user flip101:
When executing
orm:generate-entitiesto generated methods, do not generate setters when entity is readOnly@ORM\Entity(readOnly=true)@doctrinebot commented on GitHub (Jun 6, 2014):
Comment created by cstea:
I would like to see this feature but at the field level: Maybe my entity has a timestamp property that is auto-generated (uses Timestampable). I want to be able to have a getter but not a setter. Right now if I doctrine:generate and remove the setter function, it is re-created any time i re-run doctrine:generate.
I would suggest having @ORM/readonly as an available setting for properties.
@doctrinebot commented on GitHub (Jun 6, 2014):
Comment created by @ocramius:
I think this use case is simply a customization that should be applied by coding, and not via the generator.
@doctrinebot commented on GitHub (Jun 7, 2014):
Comment created by cstea:
I have made the required edits and created a pull request:
https://github.com/doctrine/doctrine2/pull/1052
http://www.doctrine-project.org/jira/browse/DDC-3157
In the case of the original request, users can use readonly on every property in the table if they chose to make the entire entity read-only.
@doctrinebot commented on GitHub (Jun 7, 2014):
Comment created by @doctrinebot:
A related Github Pull-Request [GH-1052] was closed:
https://github.com/doctrine/doctrine2/pull/1052
@doctrinebot commented on GitHub (Jun 7, 2014):
Comment created by @ocramius:
See comments on DDC-3157
@doctrinebot commented on GitHub (Jun 7, 2014):
Comment created by flip101:
The PR by Christopher Stea adds a readonly annotation for properties. This ticket is about using the readonly annotation on the class (ORM\Entity) which is already in Doctrine. And just modify the code generator a little bit to skip the setters. Please reopen!!!
@doctrinebot commented on GitHub (Jun 7, 2014):
Comment created by @ocramius:
The PR introduces metadata used solely for the purpose of code generation.
@doctrinebot commented on GitHub (Jun 7, 2014):
Comment created by flip101:
Yes that's not what THIS ticket is about, so please reopen because the PR is related, but not at all a solution to this ticket.
@doctrinebot commented on GitHub (Jun 7, 2014):
Comment created by @ocramius:
Hmm, makes sense. Re-opening then.
@Majkl578 commented on GitHub (Dec 19, 2017):
EntityGenerator will be removed completely in Doctrine 3.0.