Generating custom classes in a Compiler Extension

Notice: This thread is very old.
Member | 71


I'm building a piece of code that relies on reflections to do some stuff, similarly to how e.g. Doctrine defines column attributes using property annotations, and I'd like to move the reflection logic to a compiler extension which would create descendant classes of the classes that use this feature and then use these generated descendants in place of the original classes (e.g. as services). Basically the same thing that the DI compiler does for the whole Container, except for a single service. I know there are facilities to do this, but I can't find any documentation and the code also doesn't tell me much. Could you please point me in the right direction? wink How do I tell the container builder to add my generated ClassTypes to the compiled Container? Or do I put them elsewhere? If so, how do I then tell the container that it needs to load these additional files? Where do the cryptic class names like Container_06d644eb5e_Nette_Bridges_ApplicationLatte_ILatteFactoryImpl_latte_latteFactory come from and how do I make my own like that? And what about John Clapper??

Last edited by jahudka (2016-03-29 15:34)