如何从Zip文件安装Symfony 2.0捆绑包

编程入门 行业动态 更新时间:2024-10-25 22:36:16
本文介绍了如何从Zip文件安装Symfony 2.0捆绑包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

I tried installing the FixturesBundle as described in symfony/doc/2.0/bundles/DoctrineFixturesBundle/index.html but my proxy wont let me out.

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

So I went to github/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 github/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捆绑包

本文发布于:2023-11-07 01:08:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1565138.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   Zip   Symfony

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!