Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1215

doctrine:generate:entities creates entities incorrect visibility of properties for subclasses

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.1.1
    • Component/s: Tools
    • Security Level: All
    • Labels:
      None
    • Environment:
      Fedora 14, PHP 5.3.5

      Description

      I've created a symfony bundle with an entity that I want to use as a base across mutiple other entities:

      /**
      * @orm\Entity
      * @orm\HasLifecycleCallbacks()
      */
      class Base
      {
      /**
      * @orm\Id
      * @orm\Column(type="integer")
      * @orm\GeneratedValue(strategy="AUTO")
      */
      protected $id;
      /**
      * @orm\Column(type="string", unique="true", length="150")
      */
      protected $name;
      /**
      * @orm\Column(type="string", unique="true", length="150")
      */
      protected $username;
      ...
      }
      

      I have another entity in another bundle that extends this:

      class Extended extends \Test\Entity\Base
      

      When I run doctrine:generate:entites it incorrectly generates the extended class - it sets all inherited properties as 'private' which then causes PHP to raise an exception because properties on an extended class have more restrictive visibility than from the base class.

      It probably shouldn't be auto-generating the properties in the extended class at all, or generating getters/setters since that then overrides my base implementation by default.

        Activity

        Hide
        Benjamin Eberlei added a comment -

        Should be fixed

        Show
        Benjamin Eberlei added a comment - Should be fixed

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            james brown
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: