• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Custom property returning NSDictionary with values appear nil in ERRest response
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Custom property returning NSDictionary with values appear nil in ERRest response


  • Subject: Custom property returning NSDictionary with values appear nil in ERRest response
  • From: Farrukh Ijaz <email@hidden>
  • Date: Sat, 19 May 2012 23:03:13 +0300

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@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: **SOLVED** Or qualifier (including a many-to-many 'containsObject') give wrong results
  • Next by Date: Re: Ajax and multiple file uploads
  • Previous by thread: ERXNSLogLog4jBridge (solved)
  • Next by thread: REST API with WebObjects
  • Index(es):
    • Date
    • Thread