1

After installing the VichUploadBundle a service can not be loaded. Causing ReflectionException: Class does not exist

Followed the installation guide here https://github.com/dustin10/VichUploaderBundle/blob/master/Resources/doc/installation.md

This is the end of the stack trace.

  1. in ContainerBuilder.php line 887
  2. at ReflectionClass->__construct('') in ContainerBuilder.php line 887
  3. at ContainerBuilder->createService(object(DefinitionDecorator), 'cache.annotations') in ContainerBuilder.php line 443
  4. at ContainerBuilder->get('cache.annotations', 1) in ContainerBuilder.php line 946
  5. at ContainerBuilder->resolveServices(object(Reference)) in ContainerBuilder.php line 943
  6. at ContainerBuilder->resolveServices(array('C:\wamp64\sandbox\projects\practice-projects\hp-cv-s3\w\var\cache\dev/annotations.php', object(Reference))) in ContainerBuilder.php line 868
  7. at ContainerBuilder->createService(object(Definition), '03e098e19215084aaa7cf2863cac2f358625255a5c121c1a279cf4305af46de1_1') in ContainerBuilder.php line 443
  8. at ContainerBuilder->get('03e098e19215084aaa7cf2863cac2f358625255a5c121c1a279cf4305af46de1_1', 1) in ContainerBuilder.php line 946
  9. at ContainerBuilder->resolveServices(object(Reference)) in ContainerBuilder.php line 943
  10. at ContainerBuilder->resolveServices(array(object(Reference))) in ContainerBuilder.php line 868
  11. at ContainerBuilder->createService(object(Definition), 'annotations.cache') in ContainerBuilder.php line 443
  12. at ContainerBuilder->get('annotations.cache', 1) in ContainerBuilder.php line 946

Any idea how to solve this?

Best Regards, Hendrik

Hendrik
  • 73
  • 7

4 Answers4

1

In symfony 3.2, the annotations are not configured by default anymore, be sure you have the config enabled:

framework:
    annotations:
        cache:   file
        debug:   true
        file_cache_dir: '%kernel.cache_dir%/annotations'
Heah
  • 2,349
  • 14
  • 25
0

Every answer about symfony should begin from phrase :

try to clear:cache.

Maybe this helps to solve the problem.

staskrak
  • 873
  • 2
  • 10
  • 22
  • Have tried to clear the cache, but the error causes the clearing of cache to fail. I have manually deleted the cache files, but that didn't help either. – Hendrik Sep 24 '16 at 07:04
  • Try to run in symfony console the asset install command. Also check the permissions on the vendor folder. If cache clear failed - then you have mistakes. You need to solve them. – staskrak Sep 24 '16 at 07:57
  • Also if you have mapped the uploading, like says in the usage section of the tutorial - check the permissions of the uppload destination folder – staskrak Sep 24 '16 at 08:03
  • Assets:install command doesn't help either, as I can't run any commands as long as I get the error. My Vich is throwing that error already with bare minimum settings "vich_uploader: db_driver: orm" which should be enough as stated in the install section. Thanks for suggestions. – Hendrik Sep 25 '16 at 09:37
0

I got it solved.

The issue was the version of Symfony I was using.

I had "symfony/symfony": "3.2.x-dev" installed, which apparently doesn't work with "vich/uploader-bundle": "1.1.x.dev", so I installed "symfony/symfony": "^3.1.4" and Vich works like a charm.

Hendrik
  • 73
  • 7
0

Fixed in Symfony 3.2 RC2 with https://github.com/symfony/symfony/pull/20601

Nicolas Grekas
  • 686
  • 5
  • 6