alexdebril / rss-atom-bundle

RSS and Atom Bundle for Symfony
MIT License
139 stars 49 forks source link

Not able to understand the purpose of readFeed() #77

Closed shairyar closed 9 years ago

shairyar commented 9 years ago

Hi,

I can get the feeds i want to fetch using

$feed = $reader->getFeedContent($url, $date);

however I dont undetstand the purpose of readFeed(), i read the documentation but i still dont understand the purpose of it, what do you mean by

readFeed() is designed to hydrate an object you pass as an argument.

and then in the example you mentioned

 
// create your own Feed
$feed = new Acme\Feed; 

Once I have the feeds i need, where does readFeed() comes into play and why will i need it?

alexdebril commented 9 years ago

Let's say you have your own Feed class and you don't want to use the one provided by rss-atom-bundle.

This class could be AppBundle\Entity\Feed and would be like this :


namespace AppBundle\Entity;

use Debril\RssAtomBundle\Protocol\FeedInterface

class Feed implements FeedInterface
{
    // implement here all FeedInterface methods
}

Now you can call readFeed() to fill your own object with the feed's content :


$feed = new AppBundle\Entity\Feed;
$feedReader->readFeed($url, $feed, $modifiedSince);

I hope this explanation helps.

shairyar commented 9 years ago

I want to use the class that came with rss-atom-bundle to add feeds to database how do I do that?

alexdebril commented 9 years ago

I think you should map rss-atom-bundle class in doctrine mapping using YAML configuration like explained in this documentation : http://doctrine-orm.readthedocs.org/en/latest/reference/yaml-mapping.html