zikula/core — pull request #1614 by craigh (2014-02-15 14:43:42+00:00)
Title: [WIP] correct ClassNotFoundException on json update

*re-opening closed PR because of branch switch*

if a module/bundle's json file is updated the Extensions module is not equipped to handle it.

the error that gets thrown is

> ClassNotFoundException: Attempted to load class "AcmeExampleModule" from namespace "Acme\ExampleModule" in /Applications/MAMP/htdocs/core.git/src/system/Zikula/Module/ExtensionsModule/Api/AdminApi.php line 500. Do you need to "use" it from another namespace?

| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| Refs tickets | -
| License | MIT
| Doc PR | -

- [x] fix location of routing file (unrelated to this problem)
- [x] add upgrade method for bundle changes
- [ ] overcome need to load extensions module page **twice** to accomplish changes

For some reason, the changes happen in the bundles table immediately and the json file is of course changed already, but the extensions module fails to recognize those changes on the first page load. on **reloading again**, the changes are recognized and everything is fine.

you can test by toggling the psr value in the json file between 0/4 and seeing what happens every other page load.

@cmfcmf or @drak - can you help with this last part of the problem?

---

### Later comments

I cannot figure this out. I think it has something to do with setting the autoloader for the class but it is above my head. :frowning:

@drak or @cmfcmf you will have to take it from here.

merging this now would at least get us halfway there, but correctly loading modules/bundles with changed json files requires two page loads even with this, but is totally broken otherwise.

others will encounter this problem - especially as modules in development change to psr-4

---

@drak - any ida why this would require two page loads? Can you help solve this please?