Hi Farrukh,

Looks like ERRest is thinking that a dict is a relationship, so add a filter 
with all keys when you include the dict in your main filter:
   
 filter.include(SocialPost.NETWORK_PROPERTIES, ERXKeyFilter.filterWithAll());

> Hi Guys,
> 
> I'm facing a situation and shall appreciate if anyone can lead to some 
> possibility to achieve this?
> 
> I've an entity named "SocialPost" which I use to link a social post with my 
> entity where user can comment. The SocialPost has a toOne relationship with 
> SocialNetwork and SocialNetwork has toMany relationship to NetworkProperty. 
> I've defined a getter which returns a dictionary of network properties so in 
> my rest response, I want to have the network properties as key value pairs.
> 
> class SocialPost extends _SocialPost {
>       
>       public NSDictionary<String, String> networkProperties() {
>               NSDictionary<String, String> _props = new 
> NSMutableDictionary<String, String>();
>               for(EntityProperty prop : toEntityProperties) {
>                       _props.put(prop.propertyName(), prop.propertyValue());
>               }
>               return _props;
>       }
> 
> }
> 
> The problem is the networkProperties() remains empty in the rest response:
> 
> "toSocialPosts" = (
>       {
>               "networkProperties" = {
>                       "nil" = "true";
>               };
>               "toSocialNetwork" = {
>                       "type" = "SocialNetwork";
>                       "id" = "1";
>                       "toNetworkProperties" = ();
>               };
>               "id" = "2";
>               "networkName" = "Facebook";
>               "type" = "SocialPost";
>               "postId" = "256807467747310_351040008267284";
>       },
>       {
>               
> "networkProperties" = {
>                       "nil" = "true";
>               };
> 
>               "toSocialNetwork" = {
>                       "type" = "SocialNetwork";
>                       "id" = "2";
>                       "toNetworkProperties" = (
>                               {
>                                       "type" = "NetworkProperty";
>                                       "id" = "2";
>                                       "propertyKeyName" = "twitterMention";
>                               }
>                       );
>               };
>               "id" = "6";
>               "networkName" = "Twitter";
>               "type" = "SocialPost";
>               "postId" = "20120409T102500";
>       }
> );
> 
> It should be something like:
> 
> "toSocialPosts" = (
>       {
>               "networkProperties" = {
>                       "nil" = "true";
>               };
>               "toSocialNetwork" = {
>                       "type" = "SocialNetwork";
>                       "id" = "1";
>                       "toNetworkProperties" = ();
>               };
>               "id" = "2";
>               "networkName" = "Facebook";
>               "type" = "SocialPost";
>               "postId" = "256807467747310_351040008267284";
>       },
>       {
>               
> "networkProperties" = {
>                       
> "twitterMention" = "@ijazfx";
>               };
> 
>               "toSocialNetwork" = {
>                       "type" = "SocialNetwork";
>                       "id" = "2";
>                       "toNetworkProperties" = (
>                               {
>                                       "type" = "NetworkProperty";
>                                       "id" = "2";
>                                       "propertyKeyName" = "twitterMention";
>                               }
>                       );
>               };
>               "id" = "6";
>               "networkName" = "Twitter";
>               "type" = "SocialPost";
>               "postId" = "20120409T102500";
>       }
> );
> 
> 
> Am I missing something?
> 
> Thanks in advance,
> 
> Farrukh
>       
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/probert%40macti.ca
> 
> This email sent to [email protected]

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

This email sent to [email protected]

Reply via email to