ZF2 + doctrine without composer(ZF2+没有作曲家的学说)
问题描述
我有一个可用的 ZF2(骨架)应用程序并且想要集成 Doctrine.
I have a working ZF2 (skeleton) application and want to integrate Doctrine.
我已经从 github 下载了 2 个模块(DoctrineModule 和 DoctrineORMModule),因为我无法使用 composer(所以请不要回答:get composer").
I have downloaded the 2 modules (DoctrineModule and DoctrineORMModule) from github as I'm unable to use composer (so please don't answer with; "get composer").
经过数小时的尝试查找问题后,我不断收到以下错误:
After hours of trying to find the problem I keep getting the following error:
致命错误:在第 54 行的学说/DoctrineModule/src/DoctrineModule/Module.php 中找不到DoctrineCommonAnnotationsAnnotationRegistry"类.
Fatal error: Class 'DoctrineCommonAnnotationsAnnotationRegistry' not found in doctrine/DoctrineModule/src/DoctrineModule/Module.php on line 54.
我花了数小时的时间进行搜索和调试,但找不到修复方法.请帮帮我.
I have spend hours of searching and trying to debug but I can't find a way to fix it. Please help me.
推荐答案
DoctrineORMModule
没有明确支持没有 Composer 的自动加载(因为它很乱).
DoctrineORMModule
does not explicitly support autoloading without composer (since it's a mess).
从 DoctrineORMModule
的当前 (0.7.*
) 版本开始,所需的包如下:
As of current (0.7.*
) version of DoctrineORMModule
, the required packages are following:
- doctrine/common (2.3.0)
- doctrine/dbal (2.3.2)
- symfony/控制台 (v2.1.7)
- doctrine/orm (2.3.2)
- doctrine/doctrine-module (0.7.*)
- doctrine/doctrine-orm-module (0.7.0)莉>
- doctrine/common (2.3.0)
- doctrine/dbal (2.3.2)
- symfony/console (v2.1.7)
- doctrine/orm (2.3.2)
- doctrine/doctrine-module (0.7.*)
- doctrine/doctrine-orm-module (0.7.0)
您可以做的是在 init_autoloader 中定义所有自动加载命名空间.php
在你的骨架应用程序中(解释混乱).要替换的代码是关于自动加载器工厂的部分:
What you can do is defining all the autoloading namespaces in init_autoloader.php
in your skeleton application (explaining the mess). The code to replace is the part about the autoloader factory:
ZendLoaderAutoloaderFactory::factory(array(
'ZendLoaderStandardAutoloader' => array(
'autoregister_zf' => true,
'namespaces' => array(
'DoctrineCommon' => __DIR__ . '/vendor/doctrine/common',
'DoctrineDBAL' => __DIR__ . '/vendor/doctrine/dbal',
'SymfonyConsole' => __DIR__ . '/vendor/symfony/console',
'DoctrineModule' => __DIR__ . '/vendor/doctrine/doctrine-module',
'DoctrineORMModule' => __DIR__ . '/vendor/doctrine/doctrine-orm-module',
),
),
));
您必须自己配置各种 git 子模块
You will have to configure the various git submodules on your own
从模块的0.8.*
版本开始,由于最近doctrine/common
的拆分方式,依赖会增加不少,因此考虑寻找解决方案开始使用作曲家,否则你将来只会拖延巨大的问题.
As of version 0.8.*
of the modules, the dependencies will increase quite a bit because of how doctrine/common
was splitted recently, so consider finding a solution to start using composer or you will just be delaying huge problems in future.
这个解决方案现在应该有效.
This solution should work for now.
这篇关于ZF2+没有作曲家的学说的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:ZF2+没有作曲家的学说


- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- PHP - if 语句中的倒序 2021-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01