Jira issue originally created by user flip101:
When executing orm:generate-entities to generated methods, do not generate setters when entity is readOnly @ORM\Entity(readOnly=true)
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.
Comment created by @ocramius:
I think this use case is simply a customization that should be applied by coding, and not via the generator.
I have made the required edits and created a pull request:
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.
Comment created by @doctrinebot:
A related Github Pull-Request [GH-1052] was closed:
See comments on DDC-3157
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!!!
The PR introduces metadata used solely for the purpose of code generation.
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.
Hmm, makes sense. Re-opening then.