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

Closed
opened 2026-01-22 12:56:58 +01:00 by admin · 5 comments
Owner

Originally created by @doctrinebot on GitHub (Aug 27, 2010).

Originally assigned to: @beberlei on GitHub.

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.

Originally created by @doctrinebot on GitHub (Aug 27, 2010). Originally assigned to: @beberlei on GitHub. 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.
admin added the Bug label 2026-01-22 12:56:58 +01:00
admin closed this issue 2026-01-22 12:56:58 +01:00
Author
Owner

@doctrinebot commented on GitHub (Aug 28, 2010):

Comment created by @beberlei:

fixed formating

@doctrinebot commented on GitHub (Aug 28, 2010): Comment created by @beberlei: fixed formating
Author
Owner

@doctrinebot commented on GitHub (Aug 28, 2010):

Comment created by @beberlei:

Fixed

@doctrinebot commented on GitHub (Aug 28, 2010): Comment created by @beberlei: Fixed
Author
Owner

@doctrinebot commented on GitHub (Aug 28, 2010):

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 commented on GitHub (Aug 28, 2010): 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 ```
Author
Owner

@doctrinebot commented on GitHub (Aug 28, 2010):

Comment created by @beberlei:

ok, i dropped the use statement.

@doctrinebot commented on GitHub (Aug 28, 2010): Comment created by @beberlei: ok, i dropped the use statement.
Author
Owner

@doctrinebot commented on GitHub (Aug 28, 2010):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Aug 28, 2010): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#950