Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

MASHUP: Combining results from 2 DataObjecySets


Go to End


2 Posts   2235 Views

Avatar
freeyland

Community Member, 22 Posts

14 August 2007 at 9:51pm

Edited: 14/08/2007 9:52pm

Suppose in mashup:

		$yw = new RestfulService($feed,$location_name,$cash_lifetime);
		$params = array(
				"u"=>"C",
				"p"=>$YahooCode
		);
		$yw->setQueryString($params);
		$conn = $yw->connect();
		
		$yahooWeather = $yw->searchAttributes($conn, "//yweather:condition"); 
		
		Debug::show($yahooWeather);
		return $yahooWeather;

Suppose if I want to get data from an other attribute:
$yahooWeather2 = $yw->searchAttributes($conn, "//yweather:forecast");
Can I combine yahooWeather and yahooWeather2 to return 1output?

Avatar
freeyland

Community Member, 22 Posts

23 August 2007 at 9:21pm

I tried with merge:
$yahooWeather->merge($yahooWeather2);

The problem is that when using in the template (Control) , you will have 2 arrayresults. How can we combine them into 1 array result?