Open silverbackdan opened 6 years ago
Weirdly, if I change the annotations between use Doctrine\ODM\CouchDB\Mapping\Annotations as CouchDB;
and use Doctrine\ODM\CouchDB\Mapping\Annotations\Id
for example, the first load runs without an error.
OK, I understand what is going on now. SF4 has a config file in their framework that runs only on the first load: https://github.com/symfony/symfony/blob/0b1b8959d371d4baf9db9db6f537e59d686f89c2/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml#L18-L22
I've raised an issue about this. I feel it should run every time or not at all. Therefore it'd add the loader class_exists
I remember seeing this while trawling through code though: https://github.com/doctrine/annotations/blob/master/lib/Doctrine/Common/Annotations/AnnotationRegistry.php#L136
Perhaps a simple solution to not require the deprecated function calls could be to change the 'autoload' flag to true (back to default) - I'm not sure but it may solve the issue.
Update: this was not a SF4 issue. Annotations loader just needs updating in this bundle at some point. I'm not actively using the bundle right now so probably won't be able to write a PR but I'll leave the issue open just in case.
The Readme suggests adding this to load the annotations:
I went to do this and saw that it is deprecated and will be removed in 2.0
I don't like using deprecated functions and without calling that I get an error
I've noticed within the bundle there are a couple of calls to deprecated functions too such as in TestInit.php
I don't suppose there's a quick solution to this? I've read that doctrine should use the autoload.php file but it doesn't seem to be for me I don't think.