Details

    • Type: Improvement Improvement
    • Status: Reopened
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      When executing `orm:generate-entities` to generated methods, do not generate setters when entity is readOnly `@ORM\Entity(readOnly=true)`

        Activity

        Hide
        Christopher Stea added a comment -

        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.

        Show
        Christopher Stea added a comment - 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.
        Hide
        Marco Pivetta added a comment -

        I think this use case is simply a customization that should be applied by coding, and not via the generator.

        Show
        Marco Pivetta added a comment - I think this use case is simply a customization that should be applied by coding, and not via the generator.
        Hide
        Christopher Stea added a comment -

        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.

        Show
        Christopher Stea added a comment - 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.
        Hide
        Doctrine Bot added a comment -

        A related Github Pull-Request [GH-1052] was closed:
        https://github.com/doctrine/doctrine2/pull/1052

        Show
        Doctrine Bot added a comment - A related Github Pull-Request [GH-1052] was closed: https://github.com/doctrine/doctrine2/pull/1052
        Hide
        Marco Pivetta added a comment -

        See comments on DDC-3157

        Show
        Marco Pivetta added a comment - See comments on DDC-3157
        Hide
        Flip added a comment - - edited

        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!!!

        Show
        Flip added a comment - - edited 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!!!
        Hide
        Marco Pivetta added a comment -

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

        Show
        Marco Pivetta added a comment - The PR introduces metadata used solely for the purpose of code generation.
        Hide
        Flip added a comment -

        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.

        Show
        Flip added a comment - 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.
        Hide
        Marco Pivetta added a comment -

        Hmm, makes sense. Re-opening then.

        Show
        Marco Pivetta added a comment - Hmm, makes sense. Re-opening then.

          People

          • Assignee:
            Marco Pivetta
            Reporter:
            Flip
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated: