DDC-3087: Entity code generation skip setters #3861

Open
doctrinebot opened this Issue Apr 15, 2014 · 9 comments

2 participants

@doctrinebot

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)

@doctrinebot

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

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

Comment created by cstea:

I have made the required edits and created a pull request:

#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.

@doctrinebot

Comment created by @doctrinebot:

A related Github Pull-Request [GH-1052] was closed:
#1052

@doctrinebot

Comment created by @ocramius:

See comments on DDC-3157

@doctrinebot

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

Comment created by @ocramius:

The PR introduces metadata used solely for the purpose of code generation.

@doctrinebot

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

Comment created by @ocramius:

Hmm, makes sense. Re-opening then.

@Ocramius Ocramius was assigned by doctrinebot Dec 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment