Closed saadiashairyar closed 9 years ago
You also mention the following statement at https://github.com/alexdebril/rss-atom-bundle/wiki/Reading-feeds#using-readfeed
The $feed object is then filled with Item instances.
I am puzzled how it is done? am i suppose to define a service because i do not see doctrine being called anywhere to add fetched feeds in database and linking the variable $feed with Item instances.
My understanding is that readFeed($url, $feeds, $date)
will automatically add my feeds in database or am i supposed to add the following doctrine code? if i am supposed to add the following code then how can I link the Item instance with my Entiry so the RSS feeds get added?
$em = $this->getDoctrine()->getManager(); $em->persist($feeds); $em->flush();
HI,
rss-atom-bundle doesn't explicitely calls Doctrine while reading, it builds a Feed and thren it's yours to store it in database.
I made a test project, look at https://bitbucket.org/adebril/feed-aggregator-bundle/src/781c4fc004a4ce9feb89db30aaf5ae4d827c3480/Command/AbstractCommand.php?at=master#cl-35
the command gets a Feed instance from the Reader and then use the FeedRepository to save it : https://bitbucket.org/adebril/feed-aggregator-bundle/src/781c4fc004a4ce9feb89db30aaf5ae4d827c3480/Entity/FeedRepository.php?at=master#cl-100
In feed-aggregator-bundle I used custom Feed and Item classes to handle the link in database and I referenced them in the bundle's service parameters : https://bitbucket.org/adebril/feed-aggregator-bundle/src/781c4fc004a4ce9feb89db30aaf5ae4d827c3480/Resources/config/services.xml?at=master
I hope those code samples will help.
Cheers
I cant view the links you shared, i see the error Access denied
Sorry, the repository was private I just made it public
After reading the instructions I can get the RSS feeds however I am not able to insert them into database.
This is the controller I have that fetches the feeds and then should insert into database
I do not see any error and I do not see any feeds inside my database table as well.
This is my Feed Entity
What am I doing wrong?