Doctrine Migrations
  1. Doctrine Migrations
  2. DMIG-6

Put Migrations under own namespace to avoid problems with Autoloader

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Labels:
      None

      Description

      I think it would be a good idea to put the Migrations classes under their own namespace. If you use \Doctrine\Common\ClassLoader for loading both, DBAL and Migrations, you need to load Migrations before DBAL to avoid raising an exception.

      Throws exception:

      $classLoader = new \Doctrine\Common\ClassLoader('Doctrine\DBAL', realpath(APPLICATION_PATH . '/../library/Doctrine/DBAL/lib'));
      $classLoader->register();
      $classLoader = new \Doctrine\Common\ClassLoader('Doctrine\DBAL\Migrations', realpath(APPLICATION_PATH . '/../library/Doctrine/Migrations/lib'));
      $classLoader->register();
      

      Works:

      $classLoader = new \Doctrine\Common\ClassLoader('Doctrine\DBAL\Migrations', realpath(APPLICATION_PATH . '/../library/Doctrine/Migrations/lib'));
      $classLoader->register();
      $classLoader = new \Doctrine\Common\ClassLoader('Doctrine\DBAL', realpath(APPLICATION_PATH . '/../library/Doctrine/DBAL/lib'));
      $classLoader->register();
      

        Activity

        Marcus Stöhr created issue -
        Hide
        Jonathan H. Wage added a comment -

        I am not sure we should do this. The migrations are an extension of the DBAL so it makes sense to be under that namespace. I thin it is normal to have to register the autoloaders in the right order, no?

        Show
        Jonathan H. Wage added a comment - I am not sure we should do this. The migrations are an extension of the DBAL so it makes sense to be under that namespace. I thin it is normal to have to register the autoloaders in the right order, no?
        Hide
        Marcus Stöhr added a comment -

        Yes, with the migrations being an extension of the DBAL I agree with you. As of today I wasn't aware of the fact that the autoloader using a stack (I should have checked that prior). However, it would be nice to have either some documentation about it or extend the ClassLoader to handle this implicit.

        Show
        Marcus Stöhr added a comment - Yes, with the migrations being an extension of the DBAL I agree with you. As of today I wasn't aware of the fact that the autoloader using a stack (I should have checked that prior). However, it would be nice to have either some documentation about it or extend the ClassLoader to handle this implicit.
        Hide
        Jonathan H. Wage added a comment -

        I will add some documentation about using multiple class loaders and order.

        Show
        Jonathan H. Wage added a comment - I will add some documentation about using multiple class loaders and order.
        Benjamin Eberlei made changes -
        Field Original Value New Value
        Assignee Jonathan H. Wage [ jwage ] Benjamin Eberlei [ beberlei ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DMIG-6, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Marcus Stöhr
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: