Zend Framework 2: AnnotationRegistry not found

Accoording to this tutorial I wanted to create a simple login, when ZF2 threw this ‘helpful’ errormessage:

Fatal error: Class 'Doctrine\Common\Annotations\AnnotationRegistry' not found in \zendframework\zendframework\library\Zend\Code\Annotation\Parser\DoctrineAnnotationParser.php on line 42

Turns out when using that stupid composer the way it is recommended in the official tutorial, it doesn’t install doctrine (WTF?!). So the following must be done:

  1. in vendor/compuser/installed.json add a row in require :
            "require": {
                "doctrine/common": ">=2.1", //neu
                "php": ">=5.3.3"
            },
  2. start the console and call the following:
    php composer.phar update

And suddenly it works.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.