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.

Blog Module /

Discuss the Blog Module.

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

RSSWidget uses deprecated DataObjectSet


Go to End


5 Posts   1972 Views

Avatar
joko

Community Member, 6 Posts

24 September 2012 at 9:50am

Hi,

I'm trying to integrate a RSS-Feed of a blog on my Site, running Silverstripe 3.0.2 with the actual blog module from github. But the RSSWidget in code/widgets uses the deprecated DataObjectSet in the function getFeedItems() so it doesn't work.

	function getFeedItems() {
			$output = new DataObjectSet();

			// Protection against infinite loops when an RSS widget pointing to this page is added to this page 
			if(stristr($_SERVER['HTTP_USER_AGENT'], 'SimplePie')) { 
				return $output;
			}

			include_once(Director::getAbsFile(SAPPHIRE_DIR . '/thirdparty/simplepie/simplepie.inc'));

			$t1 = microtime(true);
			$feed = new SimplePie($this->AbsoluteRssUrl, TEMP_FOLDER);
			$feed->init();
			if($items = $feed->get_items(0, $this->NumberToShow)) {
				foreach($items as $item) {

					// Cast the Date
					$date = new Date('Date');
					$date->setValue($item->get_date());

					// Cast the Title
					$title = new Text('Title');
					$title->setValue($item->get_title());

					$output->push(new ArrayData(array(
						'Title' => $title,
						'Date' => $date,
						'Link' => $item->get_link()
					)));
				}
				return $output;
			}
		
	}

I tried changing to ArrayList but without success.

Is there an update of this widget to be expected?

Thank you for any help.

joko

Avatar
joko

Community Member, 6 Posts

28 September 2012 at 4:19am

No suggestions from anyone?

Avatar
Willr

Forum Moderator, 5523 Posts

30 September 2012 at 6:31pm

You may wish to add this as an issue on the github account - https://github.com/silverstripe/silverstripe-blog/issues. That way the developers will be notified of the problem. Better yet, submit a pull request to solve the issue. I would imagine all you need to do is swap it for ArrayList as you said, what was the next error you got?

Avatar
joko

Community Member, 6 Posts

30 September 2012 at 8:49pm

thanks for your answer, Willr. Turns out the next error has been a problem with the widgetArea which I have solved since.
Swapping DataObjectSet to ArrayList in RSSWidget.php works fine now. Issue solved.

Avatar
shrike

Community Member, 17 Posts

30 September 2012 at 10:28pm

Joko, how did you manages to solve this? I got some nasty errors from simplepie when using code based on RSSWidget.php (wanted to create new RSS-feed from external source). I changed the DataObjectSet to ArrayList, but got "deprecated" error notice. Did you change anything else on the code?