Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2066

[GH-472] Fixed empty namespace in generated code when repository class do not have namespace

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.4
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      This issue is created automatically through a Github pull request on behalf of twinh:

      Url: https://github.com/doctrine/doctrine2/pull/472

      Message:

      When we defined a class without namespace for entity repository, just like @Entity(repositoryClass="BugRepository"), EntityRepositoryGenerator will generate the code like blow, which has error statement in namespace definition. So this is mainly added a generateEntityRepositoryNamespace method to generate the correct namespace.Just like what EntityGenerator does
      https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Tools/EntityGenerator.php#L492

      *before*
      ```php
      <?php

      namespace ; //caurse parse error: syntax error, unexpected ';', expecting T_STRING or T_NS_SEPARATOR or '{'

      use Doctrine\ORM\EntityRepository;

      /**

      • BugRepository
        *
      • This class was generated by the Doctrine ORM. Add your own custom
      • repository methods below.
        */
        class BugRepository extends EntityRepository
        {
        }
        ```
        *after*
        ```php
        <?php

      use Doctrine\ORM\EntityRepository;

      /**

      • BugRepository
        *
      • This class was generated by the Doctrine ORM. Add your own custom
      • repository methods below.
        */
        class BugRepository extends EntityRepository
        {
        }
        ````

        Activity

        Hide
        Benjamin Eberlei added a comment -

        A related Github Pull-Request [GH-472] was closed
        https://github.com/doctrine/doctrine2/pull/472

        Show
        Benjamin Eberlei added a comment - A related Github Pull-Request [GH-472] was closed https://github.com/doctrine/doctrine2/pull/472
        Show
        Fabio B. Silva added a comment - Merged : https://github.com/doctrine/doctrine2/commit/a16a935bff27d42f0a308d4dfc11a555826310a7
        Hide
        Doctrine Bot added a comment -

        A related Github Pull-Request [GH-472] was closed:
        https://github.com/doctrine/dbal/pull/472

        Show
        Doctrine Bot added a comment - A related Github Pull-Request [GH-472] was closed: https://github.com/doctrine/dbal/pull/472

          People

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

            Dates

            • Created:
              Updated:
              Resolved: