Details
-
Type:
New Feature
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: Git Master
-
Fix Version/s: None
-
Component/s: Mapping Drivers
-
Security Level: All
-
Labels:None
Description
Hi,
I've been having issues with AnnotationDriver crawling in my directories and loading files.
I have a few classes that require specific libraries loaded, and I don't want the AnnotationDriver to load them.
For example, I have my descendant of PHPUnit_Framework_TestCase in libs and the driver just dies, because PHPUnit is not loaded, and I don't want to load it, to be able to finish the process.
Solution would be add method AnnotationDriver::addExcludePath, whose name speaks for itself ![]()
Temporarily, I had to extend the AnnotationDriver and overload the crawling process, which is realy annoing, because I had to copy the whole method with all its exceptions and I would have to maintain it, till this will be in Doctrine. Can be viewed here https://github.com/Kdyby/Framework/blob/master/libs/Kdyby/Doctrine/Mapping/Driver/AnnotationDriver.php
Thanks
Filip
This behavior really messes with my projects, as it automatically loads all php files. Not just those with classes, but also simple scripts, which can do horrible stuff (e.g. I've got scripts to make changes in the source code!)
Annotations should be read without executing the scripts, e.g. by TokenReflection library: https://github.com/Andrewsville/PHP-Token-Reflection