Skip to content

Loading…

DDC-771: EntityGenerator generates wrong use statement in entity file #5286

Closed
doctrinebot opened this Issue · 5 comments

2 participants

@doctrinebot

Jira issue originally created by user martinsrom:

If I use EntityGenerator with class to extend 'Extension\Doctrine\ORM\ActiveEntity\ActiveEntity' in generated files I have this use statement:

use Extension\Doctrine\ORM\ActiveEntity;

class XXX extends ActiveEntity

and php ends with error. I think the use statement should look like:

use Extension\Doctrine\ORM\ActiveEntity\ActiveEntity;

class XXX extends ActiveEntity

After I repaired this function it works ok:

private function _getClassToExtendNamespace()
{
    $refl = new \ReflectionClass($this->_getClassToExtend());

    return $refl->getNamespaceName() ? $refl->getNamespaceName():$refl->getShortName();
}

to

return $refl->getNamespaceName() ? $refl->getNamespaceName().'\\'.$refl->getShortName():$refl->getShortName();

I'am not sure if it is bug or I am doing something wrong.

@doctrinebot

Comment created by @beberlei:

fixed formating

@doctrinebot

Comment created by @beberlei:

Fixed

@doctrinebot

Comment created by martinsrom:

After your fix, the EntityGenerator generates this:

use Extension\Doctrine\ORM\ActiveEntity\ActiveEntity;

class XXX extends Extension\Doctrine\ORM\ActiveEntity\ActiveEntity

and it isn't still right. There are two right posibilities:

use Extension\Doctrine\ORM\ActiveEntity\ActiveEntity;

class XXX extends ActiveEntity

or

class XXX extends Extension\Doctrine\ORM\ActiveEntity\ActiveEntity
@doctrinebot

Comment created by @beberlei:

ok, i dropped the use statement.

@doctrinebot

Issue was closed with resolution "Fixed"

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.0-BETA4 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.