如何从Zip文件安装Symfony 2.0捆绑包 [英] How to install a Symfony 2.0 Bundle from Zip file

查看:90
本文介绍了如何从Zip文件安装Symfony 2.0捆绑包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试按照 http://symfony.com/中的说明安装FixturesBundle。 doc / 2.0 / bundles / DoctrineFixturesBundle / index.html ,但我的代理不会让我失望。

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.

所以我去了 https://github.com/doctrine/data-fixtures 并从最新提交中下载一个zip。

So I went to https://github.com/doctrine/data-fixtures and download a zip from the latest commit.

我解压缩到供应商目录中,并将其重命名为 doctrine-fixures 。我按照本教程中的说明编辑了autoload.php和AppKernel.php文件。

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.

运行时:

php app\console doctrine:fixtures:load

I得到以下消息:

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文件的捆绑软件安装?

Is there a way to run the installation of bundle pointing it to a zip file?

我正在运行Symfony 2.0.9。在Windows 7上。

I´m running Symfony 2.0.9 on Windows 7.

推荐答案

是的,确实将Doctrine从Symfony命名空间移开了(请参阅此处)。

Yes, it's true that Doctrine is being moved away from the Symfony namespace (see here).

因此,如果您使用的是Symfony标准发行版,则可以从网站上下载(不使用git) ,并且您想要手动安装 FixturesBundle ,则必须从此处,将压缩包提取到

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 into

YourProject/vendor/doctrine-fixtures

FixturesBundle https://github.com/doctrine/DoctrineFixturesBundle rel = nofollow>此处,并将其提取到

Download the FixturesBundle from here, and extract it in

YourProject/vendor/bundles/Doctrine/Bundle/FixturesBundle

然后您必须注册图书馆的命名空间,通过添加

Then you have to register the library's namespace, do it by adding

'Doctrine\\\\Common\\\\DataFixtures' => \__DIR\__.'/../vendor/doctrine-fixtures/lib',

autoload.php 中。

此外,您还必须注册Doctrine的命名空间,因为某些部分您的应用程序将使用Symfony名称空间附带的 DoctrineBundle ,但是新下载的 FixturesBundle 将使用新的Doctrine的名称空间,因此要使其起作用,请在您的 autoload.php 中添加以下行(请注意,在之前使用Doctrine命名空间,请记住

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 downloaded FixturesBundle will be using the new Doctrine's namespace, so to make it work, in your autoload.php add the following line (taking care you do it before the Doctrine namespace, remember that more specific rules go first!)

'Doctrine\\\\Bundle' => \__DIR\__.'/../vendor/bundles',

所有现在要做的是在您的 AppKernel.php 写作

So all you have to do now is to register the new bundle in your AppKernel.php writing

new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),

这篇关于如何从Zip文件安装Symfony 2.0捆绑包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆