Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-771

EntityGenerator generates wrong use statement in entity file

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-BETA3
    • Fix Version/s: 2.0-BETA4
    • Component/s: Tools
    • Security Level: All
    • Labels:
      None
    • Environment:
      PHP 5.3.2, Windows 7 Professional

      Description

      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.

        Activity

        Hide
        Benjamin Eberlei added a comment -

        fixed formating

        Show
        Benjamin Eberlei added a comment - fixed formating
        Hide
        Benjamin Eberlei added a comment -

        Fixed

        Show
        Benjamin Eberlei added a comment - Fixed
        Hide
        Martin Srom added a comment -

        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
        
        Show
        Martin Srom added a comment - 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
        Hide
        Benjamin Eberlei added a comment -

        ok, i dropped the use statement.

        Show
        Benjamin Eberlei added a comment - ok, i dropped the use statement.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Martin Srom
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: