没有作曲家的ZF2 +教义 [英] ZF2 + doctrine without composer
问题描述
我已经从github下载了2个模块(DoctrineModule和DoctrineORMModule),因为我是无法使用作曲者(所以请不要用;获得作曲者)。
尝试找到问题几个小时后,我会收到以下错误: / p>
致命错误:类Doctrine\Common\Annotations\AnnotationRegistry没有在第54行的doctrine / DoctrineModule / src / DoctrineModule / Module.php中找到。 p>
我花了几个小时的时间来尝试调试,但是找不到一种解决方法。请帮助我。
DoctrineORMModule
没有明确支持自动加载而不是作曲家(因为这是一团糟)。
截至目前( 0.7。*
)版本的 DoctrineORMModule
,所需的软件包如下:
- 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
中自动加载命名空间在你的骨架应用程序(解释混乱)。要替换的代码是关于自动装载机工厂的部分:
Zend\Loader\AutoloaderFactory :: factory(array(
'Zend\Loader\StandardAutoloader'=>数组(
'autoregister_zf'=> true,
'namespaces'=>数组(
'Doctrine\Common '=> __DIR__。'/ vendor / doctrine / common',
'Doctrine\DBAL'=> __DIR__。'/ vendor / doctrine / dbal',
'Symfony\Console'= " __DIR__。'/ vendor / symfony / console',
'DoctrineModule'=> __DIR__。'/ vendor / doctrine / doctrine-module',
'DoctrineORMModule'=> __DIR__。 vendor / doctrine / doctrine-orm-module',
),
),
));
您将不得不自行配置各种git子模块
从版本 0.8。*
的模块,依赖关系会增加一点,因为 doctrine / common
最近被拆分,所以考虑找一个解决方案来开始使用作曲家,否则将来会拖延巨大的问题。
此解决方案现在可以工作。
I have a working ZF2 (skeleton) application and want to integrate Doctrine.
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:
Fatal error: Class 'Doctrine\Common\Annotations\AnnotationRegistry' 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
does not explicitly support autoloading without composer (since it's a mess).
As of current (0.7.*
) version of DoctrineORMModule
, the required packages are following:
- 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)
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:
Zend\Loader\AutoloaderFactory::factory(array(
'Zend\Loader\StandardAutoloader' => array(
'autoregister_zf' => true,
'namespaces' => array(
'Doctrine\Common' => __DIR__ . '/vendor/doctrine/common',
'Doctrine\DBAL' => __DIR__ . '/vendor/doctrine/dbal',
'Symfony\Console' => __DIR__ . '/vendor/symfony/console',
'DoctrineModule' => __DIR__ . '/vendor/doctrine/doctrine-module',
'DoctrineORMModule' => __DIR__ . '/vendor/doctrine/doctrine-orm-module',
),
),
));
You will have to configure the various git submodules on your own
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 +教义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!