Ocramius/GeneratedHydrator — pull request #24 by michaelmoussa (2014-08-14 15:36:00+00:00)
Title: Fix for autoloading not taking place when auto proxy generation is turned

I'll be using `GeneratedHydrator` in a production environment doing "many" hydration / extract operations per second. If `autoGenerateProxies` is set to `true` (its default setting), every call to `->getHydratorClass()` will regenerate the generated hydrator class file. My intention was to pre-generate the hydrators as part of my build process and then run production with `autoGenerateProxies` set to `false`.

However, changing that setting will break the application because the generated hydrator is no longer autoloaded. Moving `$this->configuration->getGeneratedClassAutoLoader()->__invoke($hydratorClassName);` out of the conditional fixes the issue. This fix would not break BC because generated hydrators don't work with auto proxy generation turned off anyway (unless the hydrators are autoloaded manually, in which case calling the autoloader here still wouldn't break anything).

My apologies in advance if I misunderstood how this particular aspect was supposed to work. I had to dig around a bit and figure it out myself since this particular use case isn't documented.