On 22-Jan-08, at 6:31 PM, Mike Schrag wrote:
>> Thanks Mike,
>>
>> So, I want my velogen templates to generate something like this:
>>
>> public NSArray fetchSomeObjectsFetchSpec(EOEditingContext ec,
>> BindingOneClass bindingOne, BindingTwoClass bindingTwo) {
>> ...
>> }
>>
>> I get the 'bindingOne' from the EOQualifierBindings 'name', how do
>> I get the 'BindingOneClass'?
>>
>> Do i need to check the attributePath and ask for a different key
>> path based on the result to get at the destinations class or is
>> there an easier way I'm not seeing?
> I was going to give a long explanation of how you can do it, but it
> was easier to just add some easier API ... attributePath now has a
> "childClassName" method on it, so you can call $
> {binding.attributePath.childClassName} and it will do the right
> thing for attributes or relationships (EXCEPT if you use
> ERXConstants as binding values, but I don't think this will be a
> problem).
Did these changes make into last nights build?
I've added this to my _Entity template:
#foreach ($fetchSpec in $entity.sortedFetchSpecs)
public static NSArray fetch${fetchSpec.capitalizedName}
(EOEditingContext ec#foreach ($binding in
$fetchSpec.distinctBindings), ${binding.childClassName} $
{binding.name}Binding#end) {
#if ($fetchSpec.distinctBindings.count > 0)
NSMutableDictionary bindings = new NSMutableDictionary();
#foreach ($binding in $fetchSpec.distinctBindings)
if (${binding.name}Binding != null) {
bindings.setObjectForKey(${binding.name}Binding, "$
{binding.name}");
}
#end
#end
return EOUtilities.objectsWithFetchSpecificationAndBindings(ec, "$
{entity.name}", "${fetchSpec.name}", #if
($fetchSpec.distinctBindings.count > 0) bindings);#else null);
#end
}
#end
And it doesn't get anything for the $fetchSpec.distinctBindings array.
I checked the code for EOFetchSpecification in WOLips and it looks
like getDistinctBindings() is there.
... confused.
Eclipse 3.3.2 M20071219-0800
WOLips 3.3.4777
;david
-- David LeBer Codeferous Software 'co-def-er-ous' adj. Literally 'code-bearing' site: http://codeferous.com blog: http://davidleber.net profile: http://www.linkedin.com/in/davidleber -- Toronto Area Cocoa / WebObjects developers group: http://tacow.org
This archive was generated by hypermail 2.0.0 : Wed Jan 23 2008 - 10:46:58 EST