What happened to Doctrine's Symfony Bundle rep

2019-05-07 11:08发布

问题:

I just spent the last 2 hours wondering why everything broke when I did a bin/vendors update on my project. I was getting the following errors

fatal: github.com/symfony/DoctrineMigrationsBundle.git/info/refs not found: did you run git update-server-info on the server?

fatal: github.com/symfony/DoctrineMongoDBBundle.git/info/refs not found: did you run git update-server-info on the server?

fatal: github.com/symfony/DoctrineFixturesBundle.git/info/refs not found: did you run git update-server-info on the server?

I hadn't changed anything with my deps

[DoctrineMigrationsBundle]
    git=http://github.com/symfony/DoctrineMigrationsBundle.git
    target=/bundles/Symfony/Bundle/DoctrineMigrationsBundle
[doctrine-migrations]
    git=http://github.com/doctrine/migrations.git   

[doctrine-fixtures]
    git=http://github.com/doctrine/data-fixtures.git
[DoctrineFixturesBundle]
    git=http://github.com/symfony/DoctrineFixturesBundle.git
    target=/bundles/Symfony/Bundle/DoctrineFixturesBundle

[doctrine-mongodb]
    git=http://github.com/doctrine/mongodb.git
[doctrine-mongodb-odm]
    git=http://github.com/doctrine/mongodb-odm.git
[DoctrineMongoDBBundle]
    git=http://github.com/symfony/DoctrineMongoDBBundle.git
    target=/bundles/Symfony/Bundle/DoctrineMongoDBBundle
    version=v2.0.0

After some investigation I saw that the repo locations of the bundles have changed to github.com/doctrine/. I had to change the deps locations and delete the bundles from vendors/bundles/Symfony/Bundle/ but it sure did confuse me.

I can't find any documentation on this at all, apart from the odd git diff and a small mention in the readme for the DoctrineFixturesBundle. Isn't this a non-BC change? Doesn't this affect everyone using those repos? If it's a non-BC change, why isn't there more information about it. Am I the only one affected? Or did I do something wrong (vendors update instead of install)?

I see that in the master branches of those projects, the namespaces are changing as well. Isn't this a massive non-BC change? I'm concerned that this could happen in the future when I'm about to launch a site and there doesn't seem to be much I can do about it.

回答1:

This happend quite a while ago: http://symfony.com/blog/symfony-2-1-the-doctrine-bundle-has-moved-to-the-doctrine-organization

They kept the old repos for people that hadn't updated. I wouldn't say it's really a BC break since it's not the code being changed, just the location of where the packages are served from.

Maybe just visit/subscribe to the symfony blog and any related twitter accounts. They mentioned this delete earlier today: https://twitter.com/jmikola/status/207852349782368256



回答2:

For us (using Symfony 2.0.4) it worked by just changing the git-url in deps and setting it to track branch 2.0. If you choose this approach, you must not (!) adapt the path(s) in your AppKernel.php to the Doctrine namespace. Our deps looks like this now:

[DoctrineFixturesBundle]
    git=https://github.com/doctrine/DoctrineFixturesBundle.git
    target=/bundles/Symfony/Bundle/DoctrineFixturesBundle
    version=origin/2.0


[DoctrineMigrationsBundle]
    git=https://github.com/doctrine/DoctrineMigrationsBundle.git
    target=/bundles/Symfony/Bundle/DoctrineMigrationsBundle
    version=origin/2.0

AppKernel.php looks still the same:

new Symfony\Bundle\DoctrineFixturesBundle\DoctrineFixturesBundle(),
new Symfony\Bundle\DoctrineMigrationsBundle\DoctrineMigrationsBundle(),

Also, make sure you still have the DoctrineBundles registered in autoload.php:

'Symfony\\Bundle\\DoctrineFixturesBundle' => __DIR__.'/../vendor/bundles',
'Symfony\\Bundle\\DoctrineMigrationsBundle' => __DIR__.'/../vendor/bundles',