如何从 Zip 文件安装 Symfony 2.0 捆绑包
我尝试按照 http://symfony.com/doc/2.0 中所述安装 FixturesBundle /bundles/DoctrineFixturesBundle/index.html 但我的代理不会让我出去。
所以我去了 https://github.com/doctrine/data-fixtures 并下载了一个 zip从最新的提交开始。
我解压到供应商目录并将其重命名为doctrine-fixures。我按照教程中的说明编辑了 autoload.php 和 AppKernel.php 文件。
当我运行:
php app\console doctrine:fixtures:load
我收到以下消息:
PHP Fatal error: Class 'Symfony\Bundle\DoctrineFixturesBundle\DoctrineFixturesB
undle' not found in C:\NetbeansProjects\route_rest_service\app\AppKernel.php on
line 20
Fatal error: Class 'Symfony\Bundle\DoctrineFixturesBundle\DoctrineFixturesBundle
' not found in C:\NetbeansProjects\route_rest_service\app\AppKernel.php on line
20
有没有办法运行将其指向 zip 文件的捆绑包安装?
我在 Windows 7 上运行 Symfony 2.0.9。
I tried installing the FixturesBundle as described in http://symfony.com/doc/2.0/bundles/DoctrineFixturesBundle/index.html but my proxy wont let me out.
So I went to https://github.com/doctrine/data-fixtures and download a zip from the latest commit.
I unzipped into the vendor directory and renamed it to doctrine-fixures. I edited the autoload.php and AppKernel.php files as described in the tutorial.
When I run:
php app\console doctrine:fixtures:load
I get the following message:
PHP Fatal error: Class 'Symfony\Bundle\DoctrineFixturesBundle\DoctrineFixturesB
undle' not found in C:\NetbeansProjects\route_rest_service\app\AppKernel.php on
line 20
Fatal error: Class 'Symfony\Bundle\DoctrineFixturesBundle\DoctrineFixturesBundle
' not found in C:\NetbeansProjects\route_rest_service\app\AppKernel.php on line
20
Is there a way to run the installation of bundle pointing it to a zip file?
I´m running Symfony 2.0.9 on Windows 7.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
似乎 Doctrine 包已从 Symfony 范围移回 Doctrine。
请使用 https://github.com/doctrine/DoctrineFixturesBundle
Seems like the doctrine bundle has been moved outside of Symfony scope back to Doctrine.
Please, use https://github.com/doctrine/DoctrineFixturesBundle
我遇到了同样的问题,这就是我成功解决它的方法。我开始下载此文件 data-fixtures 和 DoctrineFixturesBundle,将两者解压到
/vendor/doctrine
并创建了这个文件夹结构:然后我编辑了 AppKernel.php 并添加了
编辑位于项目根目录中的 composer.json 并添加了这两行:
我的,现在如下所示:
然后执行 composer dump-autoload -o 来重新创建类映射。这一切都归功于用户 Wouter J 和 nifr 回答了我的问题如何离线安装 DoctrineFixturesBundle
快乐编码!
I had the same problem and this is how i successfully solved it. I started to download this files data-fixtures and DoctrineFixturesBundle, unzipped both into
/vendor/doctrine
and created this folder structure:Then i edited the
AppKernel.php
and addedEdited the
composer.json
located in the root of the project and added this 2 lines:Mine, now look like this:
afterwards execute
composer dump-autoload -o
to recreate the classmap. All this was thanks to the users Wouter J and nifr that answered my question How to install DoctrineFixturesBundle offlineHappy coding!
是的,Doctrine 确实正在从 Symfony 命名空间中移出(请参阅此处)。
因此,如果您使用从网站下载的 Symfony 标准发行版(不使用 git),并且想要手动安装
FixturesBundle
,则必须从 此处,将 zip 解压到Download the
FixturesBundle
from 此处,然后将其提取到然后您必须注册库的命名空间,通过添加
autoload 来完成.php
。此外,您还必须注册 Doctrine 的命名空间,因为应用程序的某些部分将使用从 Symfony 命名空间提供的
DoctrineBundle
,但新下载的FixturesBundle
将使用新 Doctrine 的命名空间,因此要使其正常工作,请在autoload.php
中添加以下行(注意在 Doctrine 之前执行此操作)命名空间,请记住更具体的规则先行!)因此您现在要做的就是在您的
AppKernel.php
编写中注册新包Yes, it's true that Doctrine is being moved away from the Symfony namespace (see here).
So if you're using the Symfony standard distribution you download from the website (without using git), and you want to have the
FixturesBundle
installed manually, you have to download the doctrine-fixtures library from here, extract the zip intoDownload the
FixturesBundle
from here, and extract it inThen you have to register the library's namespace, do it by adding
in your
autoload.php
.In addition, you'll have to register the Doctrine's namespace, because some part of your application will be using the
DoctrineBundle
shipped from the Symfony namespace, but the new downloadedFixturesBundle
will be using the new Doctrine's namespace, so to make it work, in yourautoload.php
add the following line (taking care you do it before the Doctrine namespace, remember that more specific rules go first!)So all you have to do now is to register the new bundle in your
AppKernel.php
writing