Skip to content

Loading…

DDC-1215: doctrine:generate:entities creates entities incorrect visibility of properties for subclasses #1822

Closed
doctrinebot opened this Issue · 2 comments

2 participants

@doctrinebot

Jira issue originally created by user jboosh:

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.

@doctrinebot

Comment created by @beberlei:

Should be fixed

@doctrinebot

Issue was closed with resolution "Fixed"

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.1.1 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.