Quantcast

PR for doctrine annotations posted

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

PR for doctrine annotations posted

weierophinney
Administrator
Hey, all --

Per discussion on this list, in IRC, and during the IRC meeting, I've
refactored the ZF2 annotations support to use Doctrine annotation
syntax.

 * https://github.com/zendframework/zf2/pull/1681

This required:

 * Altering the AnnotationManager to delegate "parsing" tasks. This is
   done by triggering an event; first listener to return an object
   (representing an annotation) wins and stops the loop.

 * Moving the original annotation registration and creation into a new
   "GenericAnnotationParser" implementation. This acts as a listener on
   the AnnotationManager now, and works as it did previously when the
   functionality was inside the AM.

 * Creating a new DoctrineAnnotationParser. This class consumes the
   DocParser from the Doctrine Annotations library, and acts as a
   listener on the AM. Unlike how the DocParser normally works, the
   class expects you to register annotation classes you support, and
   then passes the annotation string _only_ (not the full docblock) to
   the DocParser instance.

If you've already started using form annotations, you may need to update
them to follow Doctrine-style syntax. The PR shows what changes I needed
to do to the various test assets to make the tests pass -- note,
however, that I did not need to do anything further to the tests, as the
primary public API has not changed!

I've unit tested the functionality from the ZF2 side, and also tried
with Doctrine. For Doctrine, you need to tell its AnnotationRegistry
where to find the ZF2 library:

    AnnotationRegistry::registerAutoloadNamespace('Zend', 'path/to/ZF2/library');

Once you've done this, it will find the ZF2 annotations without issue.

If you can, please test!

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
Loading...