Generated code for fetching supports variable substitution (FTW). However, fetch request templates which use relationships invariably use a custom class from the model. Those classes are not declared in generated header files using @class directives, resulting in compilation errors.
Solution may require caching of prettyFetchRequests before template merge is performed so that entity class names can be extracted from fetch request bindings.
I guess my fetch requests don't usually involve relationships, so I'm not running into this issue. Can you give me an example of the generated code and what code you'd like to see generated?
I have a thing A that has things B that has things C. Given thing A, I want all those things C, but not necessarily things B.
Fetch all C's where C.B==A.B.
The fetch request is generated fine, but it uses the class for A in the method signature, which isn't recognized by the compiler.
Thanks. If you want this fixed, could you fork mogeneratorTestMule and add the test entities (you can name them EntityA, EntityB, etc) and the fetch request that results in the failing codegen?
There's the hard (correct) way to fix this: do the lookups and put stash the results in an NSSet that can be accessed by the templates. But there's also an easy (hacky) way work-around: we could add an "extraMachineClassDeclararions" Entity.userInfo and you could specify it manually.
Dup'd as #123