DDC-3087: Entity code generation skip setters #3833

Closed
opened 2026-01-22 14:28:49 +01:00 by admin · 10 comments
Owner

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-entities to generated methods, do not generate setters when entity is readOnly @ORM\Entity(readOnly=true)

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-entities` to generated methods, do not generate setters when entity is readOnly `@ORM\Entity(readOnly=true)`
admin added the ImprovementWon't Fix labels 2026-01-22 14:28:49 +01:00
admin closed this issue 2026-01-22 14:28:49 +01:00
Author
Owner

@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 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.
Author
Owner

@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 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.
Author
Owner

@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 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](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.
Author
Owner

@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 @doctrinebot: A related Github Pull-Request [GH-1052] was closed: https://github.com/doctrine/doctrine2/pull/1052
Author
Owner

@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 @ocramius: See comments on [DDC-3157](http://www.doctrine-project.org/jira/browse/DDC-3157)
Author
Owner

@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 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!!!
Author
Owner

@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 @ocramius: The PR introduces metadata used solely for the purpose of code generation.
Author
Owner

@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 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.
Author
Owner

@doctrinebot commented on GitHub (Jun 7, 2014):

Comment created by @ocramius:

Hmm, makes sense. Re-opening then.

@doctrinebot commented on GitHub (Jun 7, 2014): Comment created by @ocramius: Hmm, makes sense. Re-opening then.
Author
Owner

@Majkl578 commented on GitHub (Dec 19, 2017):

EntityGenerator will be removed completely in Doctrine 3.0.

@Majkl578 commented on GitHub (Dec 19, 2017): EntityGenerator will be removed completely in Doctrine 3.0.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3833