Jump to:

1851 Posts in 1606 Topics by 561 members

Blog Module

SilverStripe Forums » Blog Module » RSSWidget uses deprecated DataObjectSet

Discuss the Blog Module.

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

Page: 1
Go to End
Author Topic: 664 Views
  • joko
    Avatar
    Community Member
    6 Posts

    RSSWidget uses deprecated DataObjectSet Link to this post

    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

  • joko
    Avatar
    Community Member
    6 Posts

    Re: RSSWidget uses deprecated DataObjectSet Link to this post

    No suggestions from anyone?

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: RSSWidget uses deprecated DataObjectSet Link to this post

    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?

  • joko
    Avatar
    Community Member
    6 Posts

    Re: RSSWidget uses deprecated DataObjectSet Link to this post

    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.

  • shrike
    Avatar
    Community Member
    15 Posts

    Re: RSSWidget uses deprecated DataObjectSet Link to this post

    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?

    664 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.