0

I installed the EkinoWordpressBundle and later removed it as, I believe, I no longer need it.

When I access my application I get this error:

Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "WordpressResponseSubscriber" from namespace "Ekino\WordpressBundle\Event\Subscriber". Did you forget a "use" statement for another namespace? in /private/var/www/cache/prod/classes.php on line 1950

When I delete classes.php manually I then get this error:

Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "WordpressResponseSubscriber" from namespace "Ekino\WordpressBundle\Event\Subscriber". Did you forget a "use" statement for another namespace? in /Library/WebServer/Documents/crmpicco/symfony/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php on line 152

I have a Wordpress app and a Symfony app sitting alongside each other, which was working until I started to strip out references to the EkinoWordpressBundle. See my other question for some background.

Why is this WordpressResponseSubscriber being referenced after I have removed it from my application first with composer and then with a fresh checkout?

crmpicco
  • 16,605
  • 26
  • 134
  • 210
  • `grep -R 'WordpressResponseSubscriber'` may be of use – Devon Bessemer Sep 11 '17 at 16:46
  • @crmpicco Can you share your composer file? Or at least the portion which has your dependencies? – PhiloEpisteme Sep 12 '17 at 13:59
  • @PhiloEpisteme Sure, here it is https://gist.github.com/crmpicco/a6cc64c4cae9384d51ff38d5738a4a09 – crmpicco Sep 12 '17 at 14:19
  • Did some more searching. Checked the source for the `ContainerAwareEventDispatcher`. Looks like the line in question is calling `foreach ($class::getSubscribedEvents() as $eventName => $params) {`. My guess is that you are passing in `WordpressResponseSubscriber` as an argument to the function `ContainerAwareEventDispatcher:: addSubscriberService`. What do you get when you grep for that class as suggested above? Or perhaps grep for `addSubscriberService` to see where you are using that? – PhiloEpisteme Sep 12 '17 at 14:28

1 Answers1

0

It looks like there was some dependency issue with EkinoWordpressBundle. You may have luck if you attempt to do the following

  1. Remove the offending dependency from composer.json

  2. Run composer update EkinoWordpressBundle

The above was sourced from a similar question and an answer by kzpap

Composer: remove a package, clean up dependencies, don't update other packages

You may want to run it first with the --dry-run flag to see what changes it will make.

Also note, if you are using composer < 1.0.0-beta2. Check out the changelog here. If you do have an older version of composer you should be able to use the --update-with-dependencies flag.

What the above command does is update EkinoWordPressBundle as well as things which are dependent on it. This includes files found in the vendor directory. In your case, the update is to remove it.

If you continue to experience issues with classes.php you may alternatively try to remove composer's caches.

composer clear-cache

Keep in mind that running the above may have obvious initial performance issues because composer will not have the cache to operate off of.

Checkout the composer docs on clear-cache etc.

Of course, it is possible that you may have non-composer managed classes which depend in the removed dependency, these will have to be removed by you.

PhiloEpisteme
  • 857
  • 3
  • 8
  • 19
  • Thanks for the answer. I have removed the bundle from composer.json and ran composer update on the bundle. I am on the latest composer. I have tried clearing composers cache with the command you provided, but the reference reappears. It's hard to see where this call is coming from considering I checked out a fresh copy of the code. – crmpicco Sep 11 '17 at 21:32
  • @crmpicco And if you just delete the whole vendor folder and reinstall with `composer install` ? – Pieter van den Ham Sep 11 '17 at 22:05
  • @Pete Yes, that's what I effectively done with a fresh checkout. – crmpicco Sep 12 '17 at 08:23