When doctrine:generate:entities - Error on TablePrefixSubscriber.php : getClassAnnotations() must be an instance of ReflectionClass
Closed this issue · 6 comments
When I run the doctrine:generate:entities command on my projet, I get this error:
PHP Catchable fatal error: Argument 1 passed to Doctrine\Common\Annotations\AnnotationReader::getClassAnnotations() must be an instance of ReflectionClass, null given, called in .../vendor/kayue/kayue-wordpress-bundle/Kayue/WordpressBundle/Subscriber/TablePrefixSubscriber.php on line 31 and defined in .../vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php on line 153
I found a way to get around it here:
oroinc/platform#5
by adding this to Subscriber\TablePrefixSubscriber.php:
use Doctrine\Common\Persistence\Mapping\RuntimeReflectionService;
public function loadClassMetadata(LoadClassMetadataEventArgs $args)
{
$classMetadata = $args->getClassMetadata();
$rrs = new RuntimeReflectionService();
$classMetadata->wakeupReflection($rrs);
[...]
though I honestly do not understand what's going on...
Does anyone else get this issue? Is it project-related? Can this work-around be used in any case and thus be added to this bundle?
Thanks.
Hi @kayue,
Ok i tried switching back to v1.1.0 as I was on dev-master, but I straight away get this error on every page:
ORMException: Unknown Entity namespace alias 'KayueWordpressBundle'.
Any ideas? EDIT : I'm using this in production code, do you recon switching back to 1.1.0 will cause other issues for me?
Oh and does this mean issue #29 's feature should be fixed?
Many thanks,
Ah ok I got it, since I'm using a different entity manager than default there are some features that will be missing for me in v1.1.0 like 4d97c88
So I guess i'll switch back to dev-master and use the work-around I found for now... Since I'm not sure if the work-around will have an impact or not on others I won't propose it as a pull request, but you have everything you need in my code extract to use it if it's useful.
I see. Just FYI you can fix bundle to any commit you want, you don't have to use master branch in this case.
Oh right yeah, good idea, thanks for the tip!