没有作曲家的ZF2 +教义 [英] ZF2 + doctrine without composer

查看:86
本文介绍了没有作曲家的ZF2 +教义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个工作的ZF2(骨架)应用程序,并希望集成Doctrine。



我已经从github下载了2个模块(DoctrineModule和DoctrineORMModule),因为我是无法使用作曲者(所以请不要用;获得作曲者)。



尝试找到问题几个小时后,我会收到以下错误: / p>

致命错误:类Doctrine\Common\Annotations\AnnotationRegistry没有在第54行的doctrine / DoctrineModule / src / DoctrineModule / Module.php中找到。 p>

我花了几个小时的时间来尝试调试,但是找不到一种解决方法。请帮助我。

解决方案

DoctrineORMModule 没有明确支持自动加载而不是作曲家(因为这是一团糟)。



截至目前( 0.7。* )版本的 DoctrineORMModule ,所需的软件包如下:





你可以做的是定义所有在 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:

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屋!

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