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.
Try to edit the following method in the Module.php of the Application module:
There is no need to define autoloading configuration for
DoctrineModule
andDoctrineORMModule
because this are ZF2 modules and are providing autoloading configuration already.DoctrineORMModule
does not explicitly support autoloading without composer (since it's a mess).As of current (
0.7.*
) version ofDoctrineORMModule
, 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: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 howdoctrine/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.
Form annotations require Doctrine\Common, which contains an annotation parsering engine. The simplest way to install Doctrine\Common is if you are using Composer; simply update your composer.json and add the following line to the require section:
"doctrine/common": ">=2.1", Then run php composer.phar update to install the dependency.
If you’re not using Composer, visit the Doctrine project website for more details on installation.