I had originally used what you suggested. And this was the response:

                ERXKeyFilter filter = 
ERXKeyFilter.filterWithAttributesAndToOneRelationships();
                filter.include(FoodFamily.MAIN_IMAGE);

gives:



<foodFamily type="FoodFamily" id="1"/>




When I did what I did I get this response (all notice that it says 
ERDatabaseAttachment, this is wrong it is a File):

<foodFamily type="FoodFamily" id="1">
<mainImage type="ERDatabaseAttachment" id="1">
<available>true</available>
<configurationName nil="true"/>
<creationDate>2011-11-09T01:32:39Z</creationDate>
<height nil="true"/>
<mimeType>image/jpeg</mimeType>
<originalFileName>tomato.jpg</originalFileName>
<ownerID nil="true"/>
<proxied>true</proxied>
<size>4951</size>
<smallData nil="true"/>
<storageType>db</storageType>
<thumbnail nil="true"/>
<webPath>/1.jpg</webPath>
<width nil="true"/>
<attachmentData type="ERAttachmentData" id="1"/>
<parentAttachment nil="true"/>
</mainImage>
</foodFamily>

Regards
James





On Dec 13, 2011, at 1:08 PM, Farrukh Ijaz wrote:

> Hi James,
> 
> The filter is passed to response object in ERRest framework, and that filter 
> is applied to the object. E.g.
> 
> return response(object, filter);
> 
> The filter includes keypaths that can be reached from "object". Now this 
> object must implement NSKeyValueCodingAdditions interface.
> 
> The family filter is just a reference to the filter object which is returned 
> after includeing FoodItem.FOOD_FAMILY, so basically you're manupulating the 
> fiter object itself. You should use it as following:
> 
>> ERXKeyFilter filter = 
>> ERXKeyFilter.filterWithAttributesAndToOneRelationships();
>> filter.include(FoodFamily.MAIN_IMAGE);
>> return filter
> 
> On 2011-12-13, at 9:37 PM, James Cicenia wrote:
> 
>> The base object is a FoodItem and it has a to-one foodFamily relationship.
>> I was trying to get the foodFamily mainImage (ERAttachment) attributes.
>> 
>> After much trial and error this worked! ???? why?
>> 
>> 
>> ERXKeyFilter filter = ERXKeyFilter.filterWithAttributes();
>> ERXKeyFilter family = filter.include(FoodItem.FOOD_FAMILY);
>> family.include(FoodFamily.MAIN_IMAGE).includeAttributesAndToOneRelationships();
>> return filter
>> 
>> How does the family filter affect the returned filter?
>> 
>> Thanks James
>> 
>> 
>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/farrukh.ijaz%40fuegodigitalmedia.com
>> 
>> This email sent to [email protected]
> 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to