コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $feedItem1Reddit = new FeedItem();
     $feedItem1Reddit->setTitle('[AMA Request] Head of Potatoes Sarah Durdin Robertson');
     $feedItem1Reddit->setLink('http://www.reddit.com/r/IAmA/comments/1lx8n5/ama_request_head_of_potatoes_sarah_durdin/');
     $feedItem1Reddit->setPermaLink('http://www.reddit.com/r/IAmA/comments/1lx8n5/ama_request_head_of_potatoes_sarah_durdin/');
     $feedItem1Reddit->setContent('<!-- SC_OFF --><div><p><strong>My 5 Questions:</strong></p> <ol><li>How did this job title come about? Was it something you created or just fell into?</li> <li>What are the day-to-day (or at least project-to-project) duties of a Head of Potatoes?</li> <li>What\'s the most finicky potato product to work with?</li> <li>Were you surprised to learn your job title was at the top of Reddit\'s front page as someone\'s future career?</li> <li>How to people in normal social situations react when they learn your a Head of Potatoes? Or do you just say you\'re a \\"producer\\"?</li> </ol><p><strong>Public Contact Information:</strong> If Applicable</p> </div><!-- SC_ON --> submitted by <a href=\\"http://www.reddit.com/user/shinosa\\"> shinosa </a> to <a href=\\"http://www.reddit.com/r/IAmA/\\"> IAmA</a> <br><a href=\\"http://www.reddit.com/r/IAmA/comments/1lx8n5/ama_request_head_of_potatoes_sarah_durdin/\\">[link]</a> <a href=\\"http://www.reddit.com/r/IAmA/comments/1lx8n5/ama_request_head_of_potatoes_sarah_durdin/\\">[48 comments]</a><br/><hr/><br/><div>\\n  <table>\\n    <tr>\\n      <td align=\\"center\\">\\n        7 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        1pm\\n      </td>\\n      <td align=\\"center\\">\\n        Dale Stephens\\n      </td>\\n      <td align=\\"center\\">\\n        Founder of UnCollege.org\\n      </td>\\n    </tr>\\n    <tr readability=\\"2\\">\\n      <td align=\\"center\\">\\n        7 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        2pm\\n      </td>\\n      <td align=\\"center\\">\\n        Chris Jordan &amp; Sabine Emiliani\\n      </td>\\n      <td align=\\"center\\">\\n        directors of MIDWAY\\n      </td>\\n    </tr>\\n    <tr readability=\\"2\\">\\n      <td align=\\"center\\">\\n        7 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        4pm\\n      </td>\\n      <td align=\\"center\\">\\n        Lauren Myracle\\n      </td>\\n      <td align=\\"center\\">\\n        Best-selling author of teen/tween books and most banned author in America\\n      </td>\\n    </tr>\\n    <tr readability=\\"6\\">\\n      <td align=\\"center\\">\\n        8 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        8pm\\n      </td>\\n      <td align=\\"center\\">\\n        Tommy Tallarico\\n      </td>\\n      <td align=\\"center\\">\\n        Video game composer, TV show producer and creator, Guinness World Record holder, founder Game Audio Network Guild\\n      </td>\\n    </tr>\\n    <tr readability=\\"3\\">\\n      <td align=\\"center\\">\\n        9 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        1pm\\n      </td>\\n      <td align=\\"center\\">\\n        Chuck Leavell\\n      </td>\\n      <td align=\\"center\\">\\n        Keyboard chair in The Rolling Stones, former member of the Allman Brothers Band\\n      </td>\\n    </tr>\\n    <tr readability=\\"2\\">\\n      <td align=\\"center\\">\\n        9 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        3pm\\n      </td>\\n      <td align=\\"center\\">\\n        David Wessel\\n      </td>\\n      <td align=\\"center\\">\\n        Economics editor at The Wall Street Journal\\n      </td>\\n    </tr>\\n    <tr readability=\\"5\\">\\n      <td align=\\"center\\">\\n        9 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        5pm\\n      </td>\\n      <td align=\\"center\\">\\n        Hannah Fidell, Lindsay Burdge and Will Brittain\\n      </td>\\n      <td align=\\"center\\">\\n        writer/ director and 2 of the stars of the film A TEACHER\\n      </td>\\n    </tr>\\n    <tr readability=\\"8\\">\\n      <td align=\\"center\\">\\n        9 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        5pm\\n      </td>\\n      <td align=\\"center\\">\\n        Larry Lessig / Susan Crawford / Tim Wu\\n      </td>\\n      <td align=\\"center\\">\\n        contributors to THE INTERNET MUST GO and academic and political activist, professor at the Benjamin N. Cardozo School of Law and professor at Columbia Law School, the former chair of media reform group Free Press respectively\\n      </td>\\n    </tr>\\n    <tr readability=\\"2\\">\\n      <td align=\\"center\\">\\n        9 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        7pm\\n      </td>\\n      <td align=\\"center\\">\\n        David Epstein\\n      </td>\\n      <td align=\\"center\\">\\n        Investigative journalist with ProPublica\\n      </td>\\n    </tr>\\n    <tr>\\n      <td align=\\"center\\">\\n        9 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        9pm\\n      </td>\\n      <td align=\\"center\\">\\n        Fred Olen Ray\\n      </td>\\n      <td align=\\"center\\">\\n        Movie Director, Producer\\n      </td>\\n    </tr>\\n    <tr readability=\\"2\\">\\n      <td align=\\"center\\">\\n        9 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        11pm\\n      </td>\\n      <td align=\\"center\\">\\n        Cian Ciaran\\n      </td>\\n      <td align=\\"center\\">\\n        Keyboardist for SUPER FURRY ANIMALS\\n      </td>\\n    </tr>\\n    <tr readability=\\"7\\">\\n      <td align=\\"center\\">\\n        10 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        11am\\n      </td>\\n      <td align=\\"center\\">\\n        David Cross, Bob Odenkirk, and Brian Posehn\\n      </td>\\n      <td align=\\"center\\">\\n        Creators &amp; stars of Mr. Show, authors of HOLLYWOOD SAID NO!\\n      </td>\\n    </tr>\\n    <tr>\\n      <td align=\\"center\\">\\n        10 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        1pm\\n      </td>\\n      <td align=\\"center\\">\\n        Leonard Maltin\\n      </td>\\n      <td align=\\"center\\">\\n        Film critic / author\\n      </td>\\n    </tr>\\n    <tr readability=\\"4\\">\\n      <td align=\\"center\\">\\n        10 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        3pm\\n      </td>\\n      <td align=\\"center\\">\\n        Editors of The Paris Review\\n      </td>\\n      <td align=\\"center\\">\\n        American literary magazine\\n      </td>\\n    </tr>\\n    <tr readability=\\"3\\">\\n      <td align=\\"center\\">\\n        10 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        4:30pm\\n      </td>\\n      <td align=\\"center\\">\\n        Haifaa Al Mansour\\n      </td>\\n      <td align=\\"center\\">\\n        director of the first film made entirely in Saudi Arabia, WADJDA\\n      </td>\\n    </tr>\\n    <tr readability=\\"5\\">\\n      <td align=\\"center\\">\\n        10 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        5pm\\n      </td>\\n      <td align=\\"center\\">\\n        Thomas Peisel, Dylan Tuccillo and Jared Zeizel\\n      </td>\\n      <td align=\\"center\\">\\n        Authors of A FIELD GUIDE TO LUCID DREAMING\\n      </td>\\n    </tr>\\n    <tr>\\n      <td align=\\"center\\">\\n        10 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        7pm\\n      </td>\\n      <td align=\\"center\\">\\n        Lil Bub The Cat\\n      </td>\\n      <td align=\\"center\\">\\n        Magic Woman Space Cat\\n      </td>\\n    </tr>\\n    <tr readability=\\"3\\">\\n      <td align=\\"center\\">\\n        11 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        2pm\\n      </td>\\n      <td align=\\"center\\">\\n        Chromeo\\n      </td>\\n      <td align=\\"center\\">\\n        Dave 1 and P-Thugg, an Electrofunk Duo\\n      </td>\\n    </tr>\\n    <tr readability=\\"2\\">\\n      <td align=\\"center\\">\\n        12 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        11am\\n      </td>\\n      <td align=\\"center\\">\\n        James Reston Jr\\n      </td>\\n      <td align=\\"center\\">\\n        Historian and author of THE ACCIDENTAL VICTIM\\n      </td>\\n    </tr>\\n    <tr readability=\\"3\\">\\n      <td align=\\"center\\">\\n        12 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        1pm\\n      </td>\\n      <td align=\\"center\\">\\n        Gideon Rose\\n      </td>\\n      <td align=\\"center\\">\\n        Editor, <em>Foreign Affairs</em> Magazine\\n      </td>\\n    </tr>\\n    <tr>\\n      <td align=\\"center\\">\\n        12 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        1pm\\n      </td>\\n      <td align=\\"center\\">\\n        Outlook.com\\n      </td>\\n      <td align=\\"center\\">\\n        The Outlook.com Team\\n      </td>\\n    </tr>\\n    <tr>\\n      <td align=\\"center\\">\\n        12 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        9pm\\n      </td>\\n      <td align=\\"center\\">\\n        Eyal Levi\\n      </td>\\n      <td align=\\"center\\">\\n        musician and producer\\n      </td>\\n    </tr>\\n    <tr readability=\\"2\\">\\n      <td align=\\"center\\">\\n        13 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        10am\\n      </td>\\n      <td align=\\"center\\">\\n        Robin Givhan\\n      </td>\\n      <td align=\\"center\\">\\n        Pulitzer Prize winning fashion commenter for NY Mag &amp; Washington Post’s fashion critic\\n      </td>\\n    </tr>\\n    <tr readability=\\"4\\">\\n      <td align=\\"center\\">\\n        13 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        1:30pm\\n      </td>\\n      <td align=\\"center\\">\\n        Meghan McCain\\n      </td>\\n      <td align=\\"center\\">\\n        Author, columnist, daughter of John McCain\\n      </td>\\n    </tr>\\n    <tr readability=\\"3\\">\\n      <td align=\\"center\\">\\n        17 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        12pm\\n      </td>\\n      <td align=\\"center\\">\\n        Clyde Phillips\\n      </td>\\n      <td align=\\"center\\">\\n        Producer of Dexter, author of \\"Unthinkable\\"\\n      </td>\\n    </tr>\\n    <tr readability=\\"2\\">\\n      <td align=\\"center\\">\\n        17 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        2pm\\n      </td>\\n      <td align=\\"center\\">\\n        Guy Grundy\\n      </td>\\n      <td align=\\"center\\">\\n        Professional Australian bodybuilder and actor\\n      </td>\\n    </tr>\\n    <tr>\\n      <td align=\\"center\\">\\n        17 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        3pm\\n      </td>\\n      <td align=\\"center\\">\\n        Seth Green\\n      </td>\\n      <td align=\\"center\\">\\n        actor / comedian\\n      </td>\\n    </tr>\\n    <tr readability=\\"2\\">\\n      <td align=\\"center\\">\\n        17 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        4pm\\n      </td>\\n      <td align=\\"center\\">\\n        Jack Hidary\\n      </td>\\n      <td align=\\"center\\">\\n        Entrepreneur &amp; independent mayoral candidate for New York City\\n      </td>\\n    </tr>\\n    <tr readability=\\"2\\">\\n      <td align=\\"center\\">\\n        18 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        1pm\\n      </td>\\n      <td align=\\"center\\">\\n        Ed Skudder &amp; Zack Keller\\n      </td>\\n      <td align=\\"center\\">\\n        Creators of DICK FIGURES: THE MOVIE\\n      </td>\\n    </tr>\\n    <tr readability=\\"6\\">\\n      <td align=\\"center\\">\\n        18 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        7pm\\n      </td>\\n      <td align=\\"center\\">\\n        Joseph Gordon-Levitt\\n      </td>\\n      <td align=\\"center\\">\\n        actor, director, producer, and writer, DON JON\\n      </td>\\n    </tr>\\n    <tr>\\n      <td align=\\"center\\">\\n        19 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        2pm\\n      </td>\\n      <td align=\\"center\\">\\n        Dave Pottinger\\n      </td>\\n      <td align=\\"center\\">\\n        Programmer\\n      </td>\\n    </tr>\\n    <tr readability=\\"4\\">\\n      <td align=\\"center\\">\\n        19 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        3pm\\n      </td>\\n      <td align=\\"center\\">\\n        Electronic Privacy Information Center (EPIC)\\n      </td>\\n      <td align=\\"center\\">\\n        Challenging the NSA domestic surveillance program\\n      </td>\\n    </tr>\\n    <tr readability=\\"2\\">\\n      <td align=\\"center\\">\\n        20 Sep\\n      </td>\\n      <td align=\\"center\\">\\n        3pm\\n      </td>\\n      <td align=\\"center\\">\\n        Jon Foreman and Sean Watkins\\n      </td>\\n      <td align=\\"center\\">\\n        Band, \\"Fiction Family\\"\\n      </td>\\n    </tr>\\n  </table>\\n</div>');
     $feedItem1Reddit->setPublishedAt(new \DateTime('2013-09-07T17:24:00Z'));
     $feedItem1Reddit->setFeed($this->getReference('feed-reddit'));
     $manager->persist($feedItem1Reddit);
     $this->addReference('feeditem1-reddit', $feedItem1Reddit);
     $feedItem2Reddit = new FeedItem();
     $feedItem2Reddit->setTitle('How do I stop being a racist?');
     $feedItem2Reddit->setLink('http://www.reddit.com/r/AskReddit/comments/1lx3h4/how_do_i_stop_being_a_racist/');
     $feedItem2Reddit->setPermaLink('http://www.reddit.com/r/AskReddit/comments/1lx3h4/how_do_i_stop_being_a_racist/');
     $feedItem2Reddit->setContent('<!-- SC_OFF --><div><p>Dear reddit, </p> <p>I\'m a racist. I don\'t want to be a racist. I want to stop.<br> Before you downvote me, please read on. </p> <p>I believe that all men are created equal. I believe that the colour of one\'s skin, eyes, or hair does not matter - all that matters is what is in your head and in your heart. </p> <p>I believe all humans should be given the same basic rights. </p> <p>But whenever I see a black man on a bicycle, I think to myself \\"I wonder if he stole it\\" before I catch myself and tell me that\'s nonsense. Whenever I see a group of coloured youths, my heart-rate quickens just a little. Whenever I see a middle-eastern-looking man with a beard I think \\"terrorist\\", before I can stop myself. And so on. </p> <p>I know it\'s wrong. I know it\'s bigoted. I don\'t want to think this way. But I can\'t seem to make myself stop. </p> <p>I don\'t know how I got this way, or when it happened. Maybe it\'s my upbringing. Maybe I\'ve subconsciously adopted the racist views of people I\'ve associated with. I certainly have had no negative encounters with people of different races - in fact, rather the opposite. </p> <p>Up until now, I\'ve thought that I can compensate for this subconscious bigotry by being extra careful to treat people fairly and equitably no matter what their \\"race\\" is. </p> <p>But then something happened:<br> I had a son. </p> <p>I know now how powerful parental influence is to the formation of the personality of a child. My son picks up on my likes and dislikes (and copies them) even before I\'m aware of them myself. </p> <p>I don\'t want him to be burdened with prejudice. I want him to be an open, accepting, truly <em>cosmopolitan</em> person - not someone stuck in the hateful, tribalistic ways of the past.</p> <p>Please, reddit, help me. How can I stop being a racist?</p> <p>(This is a throwaway account, for obvious reasons)</p> </div><!-- SC_ON --> submitted by <a href=\\"http://www.reddit.com/user/unwillingracist\\"> unwillingracist </a> to <a href=\\"http://www.reddit.com/r/AskReddit/\\"> AskReddit</a> <br><a href=\\"http://www.reddit.com/r/AskReddit/comments/1lx3h4/how_do_i_stop_being_a_racist/\\">[link]</a> <a href=\\"http://www.reddit.com/r/AskReddit/comments/1lx3h4/how_do_i_stop_being_a_racist/\\">[1669 comments]</a><br/><hr/><br/><div readability=\\"54.5\\">\\n  <div readability=\\"54\\">\\n    <p>\\n      Dear reddit,\\n    </p>\\n    <p>\\n      I\'m a racist. I don\'t want to be a racist. I want to stop.<br>\\n      Before you downvote me, please read on.\\n    </p>\\n    <p>\\n      I believe that all men are created equal. I believe that the colour of one\'s skin, eyes, or hair does not matter - all that matters is what is in your head and in your heart.\\n    </p>\\n    <p>\\n      I believe all humans should be given the same basic rights.\\n    </p>\\n    <p>\\n      But whenever I see a black man on a bicycle, I think to myself \\"I wonder if he stole it\\" before I catch myself and tell me that\'s nonsense. Whenever I see a group of coloured youths, my heart-rate quickens just a little. Whenever I see a middle-eastern-looking man with a beard I think \\"terrorist\\", before I can stop myself. And so on.\\n    </p>\\n    <p>\\n      I know it\'s wrong. I know it\'s bigoted. I don\'t want to think this way. But I can\'t seem to make myself stop.\\n    </p>\\n    <p>\\n      I don\'t know how I got this way, or when it happened. Maybe it\'s my upbringing. Maybe I\'ve subconsciously adopted the racist views of people I\'ve associated with. I certainly have had no negative encounters with people of different races - in fact, rather the opposite.\\n    </p>\\n    <p>\\n      Up until now, I\'ve thought that I can compensate for this subconscious bigotry by being extra careful to treat people fairly and equitably no matter what their \\"race\\" is.\\n    </p>\\n    <p>\\n      But then something happened:<br>\\n      I had a son.\\n    </p>\\n    <p>\\n      I know now how powerful parental influence is to the formation of the personality of a child. My son picks up on my likes and dislikes (and copies them) even before I\'m aware of them myself.\\n    </p>\\n    <p>\\n      I don\'t want him to be burdened with prejudice. I want him to be an open, accepting, truly <em>cosmopolitan</em> person - not someone stuck in the hateful, tribalistic ways of the past.\\n    </p>\\n    <p>\\n      Please, reddit, help me. How can I stop being a racist?\\n    </p>\\n    <p>\\n      (This is a throwaway account, for obvious reasons)\\n    </p>\\n  </div>\\n</div>');
     $feedItem2Reddit->setPublishedAt(new \DateTime('2013-09-07T16:01:00Z'));
     $feedItem2Reddit->setFeed($this->getReference('feed-reddit'));
     $manager->persist($feedItem2Reddit);
     $this->addReference('feeditem2-reddit', $feedItem2Reddit);
     $feedItem3Reddit = new FeedItem();
     $feedItem3Reddit->setTitle('How Do You Know When You\'re Middle-Aged?');
     $feedItem3Reddit->setLink('http://imgur.com/yCQ7Xf8');
     $feedItem3Reddit->setPermaLink('http://www.reddit.com/r/funny/comments/1lx234/how_do_you_know_when_youre_middleaged/');
     $feedItem3Reddit->setContent('<table><tr><td> <a href=\\"http://www.reddit.com/r/funny/comments/1lx234/how_do_you_know_when_youre_middleaged/\\"><img src=\\"http://b.thumbs.redditmedia.com/gXlY-iZ6tihT35qU.jpg\\" alt=\\"How Do You Know When You\'re Middle-Aged?\\" title=\\"How Do You Know When You\'re Middle-Aged?\\"></a> </td><td> submitted by <a href=\\"http://www.reddit.com/user/musictechgeek\\"> musictechgeek </a> to <a href=\\"http://www.reddit.com/r/funny/\\"> funny</a> <br><a href=\\"http://imgur.com/yCQ7Xf8\\">[link]</a> <a href=\\"http://www.reddit.com/r/funny/comments/1lx234/how_do_you_know_when_youre_middleaged/\\">[44 comments]</a> </td></tr></table><br/><hr/><br/><div readability=\\"5\\">\\n  <meta http-equiv=\\"content-type\\" content=\\"text/html; charset=utf-8\\">\\n  <meta content=\\"follow,index\\">\\n  <meta content=\\"images, funny pictures, image host, image upload, image sharing, image resize\\">\\n  <meta content=\\"Imgur is used to share photos with social networks and online communities, and has the funniest pictures from all over the Internet.\\">\\n  <meta http-equiv=\\"X-UA-Compatible\\" content=\\"IE=Edge;\\">\\n  <link type=\\"application/rss+xml\\" title=\\"Imgur Gallery\\" href=\\"http://feeds.feedburner.com/ImgurGallery?format=xml\\">\\n  <link type=\\"text/css\\" href=\\"http://s.imgur.com/min/global.css?1375395668\\">\\n  <meta content=\\"image\\">\\n  <link href=\\"http://i.imgur.com/yCQ7Xf8.jpg\\">\\n  <link href=\\"http://s.imgur.com/min/gallery.css?1378494139\\"><!--[if IE 9]><link rel=\\"stylesheet\\" href=\\"http://s.imgur.com/include/css/ie-sucks.css?0\\" type=\\"text/css\\" /><![endif]--><a href=\\"javascript:;\\" title=\\"You can\'t create an album with just one image\\"></a>\\n  <div readability=\\"10.5\\">\\n    <div readability=\\"16\\">\\n      <p>\\n        That file type is not supported!\\n      </p>\\n      <p>\\n        Supported formats: JPEG, GIF, PNG, APNG, TIFF, BMP, PDF, XCF\\n      </p>\\n    </div>\\n  </div>\\n  <p>\\n    Imgur is used to share photos with social networks and online communities, and has the funniest pictures from all over the Internet.\\n  </p>\\n  <div>\\n    <div>\\n      <div readability=\\"4.0276073619632\\">\\n        <h2>\\n          How Do You Know When You\'re Middle-Aged?\\n        </h2>\\n        <div>\\n          <div>\\n            <a href=\\"http://i.imgur.com/yCQ7Xf8.jpg\\"><img src=\\"http://i.imgur.com/yCQ7Xf8.jpg\\"></a>\\n          </div>\\n        </div>\\n        <div readability=\\"8\\">\\n          <p>\\n            <span title=\\"Saturday, September 7, 2013 at 15:38 GMT\\">3 hours ago</span> · <span>43,758</span> views · <span>2.53 GB</span> bandwidth\\n          </p>\\n        </div>\\n      </div>\\n    </div>\\n  </div><noscript>\\n  <div>\\n    <img src=\\"http://pixel.quantserve.com/pixel/p-f8oruOqDFlMeI.gif\\" border=\\"0\\" height=\\"1\\" width=\\"1\\">\\n  </div></noscript>\\n</div>');
     $feedItem3Reddit->setPublishedAt(new \DateTime('2013-09-07T15:38:00Z'));
     $feedItem3Reddit->setFeed($this->getReference('feed-reddit'));
     $manager->persist($feedItem3Reddit);
     $this->addReference('feeditem3-reddit', $feedItem3Reddit);
     $feedItem1HackerNews = new FeedItem();
     $feedItem1HackerNews->setTitle('Headteacher reported London student to police for his blog');
     $feedItem1HackerNews->setLink('http://the-libertarian.co.uk/london-student-reported-to-police-enchanted-by-anarchism-and-individualism/');
     $feedItem1HackerNews->setPermaLink('http://the-libertarian.co.uk/london-student-reported-to-police-enchanted-by-anarchism-and-individualism/');
     $feedItem1HackerNews->setContent('<p><em>Original article on <a href=\\"http://the-libertarian.co.uk/london-student-reported-to-police-enchanted-by-anarchism-and-individualism/\\">the-libertarian.co.uk</a> - <a href=\\"https://news.ycombinator.com/item?id=6345669\\">Comments</a> on Hacker News</em></p> <div readability=\\"103.30872483221\\">\\n  <p>\\n    A headteacher in the London borough of Camden has come under fire by bloggers for reporting one of his students to police after reading the student’s blog, which criticised the school and revealed the student’s ‘enchantment’ with the philosophies of anarchism and individualism.&nbsp; The student, named Kinnan Zaloom, 19, operated the ‘Hampstead Trash’ blog as an outlet for his and his classmates’ dissatisfaction with the practices of the Hampstead School and the conduct of its employees, lambasting the school’s overspending on promotional material, lack of investment in musical instruments and gym equipment, insincere attempts to listen to pupils’ views about the school, and a failure to raise GCSE results to a higher level.\\n  </p>\\n  <p>\\n    The headteacher, in addition to reporting Zaloom to the police, phoned Glasgow University, where the student had applied to study, in an attempt to dissuade them from accepting him.\\n  </p>\\n  <p>\\n    While the headteacher’s actions may certainly be described as an overreaction, what is more worrying is his own justification for them.\\n  </p>\\n  <p>\\n    Asked what had first inclined him to contact the police, Mr. Szemalikowski said “the fact that Kinnan has mentioned the ideologies of anarchism and individualism on this blog.”&nbsp; Digging himself even deeper, the headteacher added, “I must do something.&nbsp; In the last year he has become more and more enchanted by antiestablishment ways of thinking and has even said that there is an inherent risk that every government is corrupt.”\\n  </p>\\n  <p>\\n    The inherent risk of corruption in every human government, despite likely being taught by the politics faculty at Glasgow University, is evidently off-limits for discussion by pupils at the Hampstead School.&nbsp; Kinnan Zaloom, as a result of his articles, has been banned from returning to the school grounds, and now that this scandal has gone public, I imagine that alumni of the Hampstead School will be hard put to enter the grounds of Glasgow University from now on.&nbsp; It is hard to see how a school with a new and painfully poor reputation such as this could ever hope to bring its students to success.\\n  </p>\\n  <p>\\n    The Hampstead School, according to Zaloom’s blog, has for years played the school league tables and invested more of its funding in public relations than teaching, putting the reputation of the school before the success of its own students.&nbsp; The focus on collective achievement over achievement of the individual – which lies at the center of the headteacher’s philosophy – is a blight on any field or industry, but perhaps no more so than in education.&nbsp; In an economy filled with millions of different jobs and roles for millions of unique individuals with their own skills, characters, and aspirations, the job of educators is not to boost the rankings of their own institutions but to prepare their charges for the demands of an increasingly diverse world.&nbsp; Individuality is necessary for success, now more than ever, and Jacques Szemalikowski and others in his position would do well to recognise that.\\n  </p>\\n  <p>\\n    Now that the head of the school has publicly admitted to phoning universities to discourage them from accepting Hampstead students he doesn’t like, it is time for the public to hold him accountable, before another student’s career is ruined by his ideological crusade.\\n  </p>\\n  <p>\\n    “What worries me is if I had been a year younger they said they would have expelled me halfway through my A-levels,” writes Zaloom in a post.&nbsp; “That means they would have been prepared to ruin my education because they didn’t like my thoughts.”\\n  </p>\\n  <p>\\n    <a href=\\"http://www.hampsteadschool.org.uk/page/default.asp?title=Home&amp;pid=1\\">The Hampstead School</a> can be reached by telephone at:&nbsp; 020 7794 8133\\n  </p>\\n  <p>\\n    <a href=\\"http://www.camdennewjournal.com\\">The Camden New Journal</a>, which was the first to cover this story, can be reached at:&nbsp; <a href=\\"http://www.cloudflare.com/email-protection\\" data-cfemail=\\"fe97909891be9d9f939a9b90909b8994918b8c909f92d09d9193\\">[email&nbsp;protected]</a>\\n  </p>\\n</div>');
     $feedItem1HackerNews->setPublishedAt(new \DateTime('2013-09-07T18:31:56Z'));
     $feedItem1HackerNews->setFeed($this->getReference('feed-hackernews'));
     $manager->persist($feedItem1HackerNews);
     $this->addReference('feeditem1-hackernews', $feedItem1HackerNews);
     $feedItem2HackerNews = new FeedItem();
     $feedItem2HackerNews->setTitle('Is The Web Dying?');
     $feedItem2HackerNews->setLink('https://medium.com/p/b2977dbee814');
     $feedItem2HackerNews->setPermaLink('https://medium.com/p/b2977dbee814');
     $feedItem2HackerNews->setContent('<p><em>Original article on <a href=\\"https://medium.com/p/b2977dbee814\\">medium.com</a> - <a href=\\"https://news.ycombinator.com/item?id=6345634\\">Comments</a> on Hacker News</em></p> <div readability=\\"99.960590176665\\">\\n  <p>\\n    If you follow the data on mobile vs desktop sales you’ll notice that not only will the installed base of mobile devices surpass desktop but it will almost 2x in two years.\\n  </p>\\n  <figure>\\n    <img data-width=\\"600\\" data-height=\\"231\\" width=\\"600\\" height=\\"231\\" data-id=\\"337923572310\\" src=\\"https://d233eq3e3p3cv0.cloudfront.net/max/700/0*YZ0OqF4fPN2Oues7.png\\">\\n    <figcaption data-image-id=\\"337923572310\\">\\n      PC vs Smartphone sales — <a href=\\"http://ben-evans.com/benedictevans/2013/8/23/pcs-and-smartphones-the-long-view\\">source</a>\\n    </figcaption>\\n  </figure>\\n  <figure>\\n    <img data-width=\\"914\\" data-height=\\"602\\" width=\\"700\\" height=\\"461\\" data-action=\\"zoom\\" data-action-value=\\"0*EsKqr7eui3rggHd9.png\\" data-id=\\"25870539099\\" src=\\"https://d233eq3e3p3cv0.cloudfront.net/max/700/0*EsKqr7eui3rggHd9.png\\">\\n    <figcaption data-image-id=\\"25870539099\\">\\n      Desktop vs. Mobile installed base — <a href=\\"http://www.kpcb.com/insights/2012-internet-trends-update\\">source</a>\\n    </figcaption>\\n  </figure>\\n  <p>\\n    This qualifies as a paradigm shift in computing. Smartphones and tablets are essentially different mediums with different habits and a whole new human–computer interaction science. In-fact many consumers —specially in emerging markets— are jumping directly to the use of a smartphone or tablet computer without buying or learning how to use a desktop PC.\\n  </p>\\n  <blockquote>\\n    There are more than 5 billion mobile phones in the world, with almost 4 billion feature phones and more than 1 billion smartphones. As smartphone prices come down, many people who currently have feature phones will be able to afford smartphones over the next 5 years.\\n  </blockquote>\\n  <p>\\n    This comes from the <a href=\\"https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-ash3/851575_228794233937224_51579300_n.pdf\\">document</a> explaining the <a href=\\"http://internet.org/\\">internet.org</a> initiative by Facebook. Which is something I’m really excited about, it would simply help balance out the economic differences in the world a little bit by getting the rest of the world online. If a success, this will cause an explosion in the smartphone and tablet installed base units.\\n  </p>\\n  <hr>\\n  <p>\\n    <strong>How is this related to the web?</strong> If computing is moving from our laps to our pockets then we could easily look at the usage habits of mobile devices and that should give us a pretty good guess about where the Web would stand in terms of usage in the upcoming few years.\\n  </p>\\n  <p>\\n    <strong>But can’t mobile users browse the web?</strong> Yes, but according to the latest data, mobile web usage only amounts to 20% percent of the total usage of mobile devices.\\n  </p>\\n  <figure>\\n    <img data-width=\\"600\\" data-height=\\"476\\" width=\\"600\\" height=\\"476\\" data-id=\\"266944199917\\" src=\\"https://d233eq3e3p3cv0.cloudfront.net/max/700/0*UOAG1U5N7bBhzoev.png\\">\\n  </figure>\\n  <p>\\n    Provided that some apps are in-part built using the open web tech stack, however, many have publicly declared it a <a href=\\"http://venturebeat.com/2013/04/17/linkedin-mobile-web-breakup/\\">failure</a> and went <a href=\\"http://techcrunch.com/2012/09/11/mark-zuckerberg-our-biggest-mistake-with-mobile-was-betting-too-much-on-html5/\\">native</a>.\\n  </p>\\n  <p>\\n    Furthermore, many companies are creating highly suboptimal mobile experiences with the excuse that they have a mobile app that they keep trying to force it on us. This is bound to drive mobile web traffic down even more. <a href=\\"http://idontwantyourfuckingapp.tumblr.com/\\">“<em>I Don’t Want Your F*cking App</em>”</a> captures the frustration that mobile web users have to face everyday trying to do even the most trivial of tasks on the web.\\n  </p>\\n  <hr>\\n  <h2>\\n    The Browser Land Grab Game\\n  </h2>\\n  <p>\\n    <strong>But browsers are doing so much progress!</strong> Yes Google Chrome is an impressive piece technology that is capturing much of the PC browser market share with plans to move aggressively to the mobile space soon. The latest data by StatsCounter shows that not only that Chrome has the majority market share but it had also gained quite a lead over IE (the runner up).\\n  </p>\\n  <figure>\\n    <img data-width=\\"839\\" data-height=\\"529\\" width=\\"700\\" height=\\"441\\" data-action=\\"zoom\\" data-action-value=\\"0*PQ-w65AZbGJgNyFF.png\\" data-id=\\"1014955129661\\" src=\\"https://d233eq3e3p3cv0.cloudfront.net/max/700/0*PQ-w65AZbGJgNyFF.png\\">\\n  </figure>\\n  <p>\\n    Which puts Google in a position of power to change the name of the game. They started to slowly move away from the “<em>push the web platform forward”</em> gameplay to developing it’s own propriety platform as apparent in their latest <a href=\\"http://chrome.blogspot.com/2013/09/a-new-breed-of-chrome-apps.html\\">press release</a>.\\n  </p>\\n  <blockquote>\\n    Today marks the 5th birthday of Chrome, a project <a href=\\"http://googleblog.blogspot.com/2008/09/fresh-take-on-browser.html\\">we started</a> to push the web platform forward. From a humble beginning of static text, images and links, the web has grown into a rich platform teeming with interactive content and powerful applications. We’ve been astounded by how far <a href=\\"http://www.youtube.com/watch?v=Jzxc_rR6S-U\\">the web has come</a> and are very excited to see what developers around the world will be able to do with the <a href=\\"http://developer.chrome.com/apps/about_apps.html\\">new generation</a> of Chrome Apps.\\n  </blockquote>\\n  <p>\\n    The basic message I’m reading here is that they seem to have gotten enough milage out of the web, and now that they have enough market share they’re going to make some serious changes. I’m not trying to be overly cynical here. <strong>I love Chrome.</strong> I wrote <a href=\\"https://chrome.google.com/webstore/detail/ehistory/hiiknjobjfknoghbeelhfilaaikffopb?hl=en\\">extensions</a> for it, it helped me develop high quality software for the web using the debugger and dev tools, and it really did push the web forward.\\n  </p>\\n  <hr>\\n  <h3>\\n    Why Does it Matter?\\n  </h3>\\n  <p>\\n    The idea that someone would own the Web seems very wrong to me and I’m sure to many of the technologists and entrepreneurs in the world. I try to be reflective and aware of the fact that I’m deeply invested in the web and it’s going to be hard for me to speak objectively. However, the truth of the matter is that I can jump on the next application platform and be good enough to be dangerous within a month. I and many of the engineers like me will even find ways to automatically port many of our applications and knowledge to the new dominant platform.\\n  </p>\\n  <p>\\n    Nonetheless, I don’t have to be overly objective about this, because the influence of the web can’t be fully quantified. The Web as a concept and as a technology has great virtues that can’t be found elsewhere in the world and we must try to salvage it or come up with something similar. It has been a big driver of great social and economical change that has been unprecedented in the history of the world. The idea that someone can make a webpage in an afternoon, put it up online and have thousands, or even millions of people be able to find it and interact with it is completely mind-blowing. The fact that machines can understand the entirety of the human knowledge, organise it, and present it in the most convenient of ways shows that there is a great value in preserving an open and connected web of information, information processes, and communication technology.\\n  </p>\\n  <hr>\\n  <p>\\n    <em>Let me know what you think:</em> <a href=\\"https://twitter.com/amasad\\"><em>@amasad</em></a>\\n  </p>\\n</div>');
     $feedItem2HackerNews->setPublishedAt(new \DateTime('2013-09-07T18:31:57Z'));
     $feedItem2HackerNews->setFeed($this->getReference('feed-hackernews'));
     $manager->persist($feedItem2HackerNews);
     $this->addReference('feeditem2-hackernews', $feedItem2HackerNews);
     $feedItem3HackerNews = new FeedItem();
     $feedItem3HackerNews->setTitle('Which is better? Performing calculations in sql or in your application?');
     $feedItem3HackerNews->setLink('http://stackoverflow.com/questions/7510092/which-is-better-performing-calculations-in-sql-or-in-your-application');
     $feedItem3HackerNews->setPermaLink('http://stackoverflow.com/q/7510092/625840');
     $feedItem3HackerNews->setContent('<p><em>Original article on <a href=\\"http://stackoverflow.com/q/7510092/625840\\">stackoverflow.com</a> - <a href=\\"https://news.ycombinator.com/item?id=6345433\\">Comments</a> on Hacker News</em></p> <div itemprop=\\"description\\" readability=\\"68\\">\\n  <p>\\n    <code>shopkeeper</code> table has following fields:\\n  </p>\\n  <pre>\\n<code>id (bigint),amount (numeric(19,2)),createddate (timestamp)\\n</code>\\n</pre>\\n  <p>\\n    Let\'s say, I have the above table. I want to get the records for yesterday and generate a report by having the amount printed to cents.\\n  </p>\\n  <p>\\n    <strong>One way of doing is to perform calculations in my java application and execute a simple query</strong>\\n  </p>\\n  <pre>\\n<code>Date previousDate ;// $1 calculate in application\\n\\nDate todayDate;// $2 calculate in application\\n\\nselect amount where createddate between $1 and $2 \\n</code>\\n</pre>\\n  <p>\\n    and then loop through the records and convert amount to cents in my java application and generate the report\\n  </p>\\n  <p>\\n    <strong>Another way is like performing calculations in sql query itself:</strong>\\n  </p>\\n  <pre>\\n<code>select cast(amount * 100 as int) as \\"Cents\\"\\nfrom shopkeeper  where createddate  between date_trunc(\'day\', now()) - interval \'1 day\'  and  date_trunc(\'day\', now())\\n</code>\\n</pre>\\n  <p>\\n    and then loop through the records and generate the report\\n  </p>\\n  <p>\\n    In one way , all my processing is done in java application and a simple query is fired. In other case all the conversions and calculations is done in Sql query.\\n  </p>\\n  <p>\\n    The above use case is just an example, in a real scenario a table can have many columns that require processing of the similar kind.\\n  </p>\\n  <p>\\n    <strong>Can you please tell me which approach is better in terms of performance and other aspects and why?</strong>\\n  </p>\\n</div>');
     $feedItem3HackerNews->setPublishedAt(new \DateTime('2013-09-07T18:32:02Z'));
     $feedItem3HackerNews->setFeed($this->getReference('feed-hackernews'));
     $manager->persist($feedItem3HackerNews);
     $this->addReference('feeditem3-hackernews', $feedItem3HackerNews);
     $feedItem1BonjourMadame = new FeedItem();
     $feedItem1BonjourMadame->setTitle('proposé par Nonolf');
     $feedItem1BonjourMadame->setLink('http://www.bonjourmadame.fr/post/60435319843/propose-par-nonolf');
     $feedItem1BonjourMadame->setPermaLink('http://www.bonjourmadame.fr/post/60435319843');
     $feedItem1BonjourMadame->setContent('<div class=\\"content-500 menu-labels round-corners scale-images singular\\">\\n\\n\\n\\n<div id=\\"header\\" class=\\"pinned\\">\\n\\t\\t<div class=\\"inner\\">\\n\\t\\t\\t\\n            \\nLe site qui vous fera dire \\"Bonjour Madame !\\" - The site that makes you say \\"Bonjour Madame!\\"<br><strong>TOUS LES MATINS 10h, une nouvelle photo, une nouvelle fracture de l\'oeil - EVERY MORNING AT 10 (GMT +1), a new picture, a new eye fracture.</strong>\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\n\\t\\t\\t\\n\\n\\t\\t\\t\\n\\t\\t\\t<ul class=\\"menu\\"><li><a class=\\"archives\\" href=\\"http://www.bonjourmadame.fr/archive\\"><span class=\\"label\\">Archives</span></a></li>\\n                \\n                \\n                            \\n\\t\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t\\n                \\n                <li><a class=\\"random\\" href=\\"http://bonjour.plaisir-pour-tous.com/\\" title=\\"Shop\\"><span class=\\"label\\">Shop</span></a></li>\\n                <li><a class=\\"ask\\" href=\\"http://www.comboutique.com/shop/homeboutiquetsm2.php?shopid=35522\\" title=\\"Tee Shirt\\"><span class=\\"label\\">Tee Shirt</span></a></li>\\n                        \\n\\t\\t\\t</ul></div>\\n\\t\\t\\n\\t</div>\\n\\n\\t\\n\\t<div id=\\"page\\" class=\\"right-sidebar\\">\\n\\t\\t\\n\\t\\t<div class=\\"banner\\">\\n\\t\\t\\t<a href=\\"http://www.bonjourmadame.fr/\\" title=\\"Bonjour Madame\\"><img id=\\"banner\\" src=\\"http://static.tumblr.com/i4vyfyk/C4Cmbw5fi/bmlogo2.png\\" alt=\\"banner\\"></a> <a href=\\"http://www.facebook.com/pages/Bonjour-Madame/74408188101\\"><img src=\\"http://www.facebook.com/favicon.ico\\" width=\\"20\\"></a> <a href=\\"https://twitter.com/bonjour_madame\\"><img src=\\"http://www.combattrelaflemme.com/wp-content/uploads/2009/06/rsz_icon-twitter.png\\" width=\\"20\\"></a> <a href=\\"https://plus.google.com/102827775225273092690/\\"><img src=\\"http://2.bp.blogspot.com/-Srwi3RNi69w/TleLkHZUp8I/AAAAAAAAAjY/brBM1VjVbIU/s1600/google_plus_wallpaper-29.png\\" width=\\"20\\"></a>\\n\\t\\t</div>\\n\\t\\t\\n\\t\\t\\n\\t\\t<div id=\\"content\\">\\n\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t<div id=\\"post-60435319843\\" class=\\"post type-photo\\">\\n\\t\\t\\t\\t\\t<div class=\\"post-panel\\">\\n\\t\\t\\t\\t\\t\\t<div class=\\"media\\">\\n\\t\\t\\t\\t\\t\\t\\t<div class=\\"photo-panel\\">\\n\\n\\t\\t\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<img src=\\"http://31.media.tumblr.com/2d6e67e298d5e63f06f432d6edee1c04/tumblr_msobf7rJwc1qzy9ouo1_500.jpg\\" alt=\\"proposé par Nonolf\\"><div class=\\"photo-btns\\"><a class=\\"photo-url\\" href=\\"http://31.media.tumblr.com/2d6e67e298d5e63f06f432d6edee1c04/tumblr_msobf7rJwc1qzy9ouo1_500.jpg\\">View Separately</a></div>\\n\\n\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t<div class=\\"copy\\">\\n\\t\\t\\t\\t\\t\\t\\t<p>proposé par Nonolf</p>\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t<div class=\\"meta\\">\\n\\t\\t\\t\\t\\t\\t\\t<ul class=\\"meta-list\\"><li class=\\"date\\"><a href=\\"http://www.bonjourmadame.fr/post/60435319843/propose-par-nonolf\\" title=\\"Ven. septembre 6, 2013 @ 9:50 am\\">il y a 1 heure</a></li>\\n\\t\\t\\t\\t\\t\\t\\t\\t<li class=\\"notes\\"><a href=\\"http://www.bonjourmadame.fr/post/60435319843/propose-par-nonolf#notes\\">30</a></li>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\t\\t<li class=\\"permalink\\"><a href=\\"http://www.bonjourmadame.fr/post/60435319843/propose-par-nonolf\\">Permalien</a></li>\\n\\t\\t\\t\\t\\t\\t\\t\\t<li class=\\"share\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<a class=\\"share-btn\\" href=\\"http://tmblr.co/ZFByYyuIESmZ\\">J\'aime !</a>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\"share-box\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\"share-box-inside clearfix\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\"plusone-btn\\"></div>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<a href=\\"http://twitter.com/share\\" class=\\"twitter-share-button\\">Tweet</a>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\t\\t</li>\\n\\t\\t\\t\\t\\t\\t\\t</ul></div>\\n\\t\\t\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t</div>\\t\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\n\\t\\t\\t\\n\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t<div id=\\"pagination\\">\\n\\t\\t\\t\\t<div class=\\"nextprev\\">\\n\\t\\t\\t\\t\\t<span>← Précédent</span> <span class=\\"sep\\">•</span>\\n\\t\\t\\t\\t\\t<a class=\\"next\\" href=\\"http://www.bonjourmadame.fr/post/60344810883\\"><span>Suivant →</span></a>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t</div>\\n\\t\\t\\t\\n\\n\\t\\t</div>\\n\\n\\t\\t\\n                               \\n\\t\\t<div id=\\"sidebar\\">         \\n        \\n\\t\\t\\t<div id=\\"blog-info\\" class=\\"side-box\\">\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t<div class=\\"description\\">\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t<div><p><strong><img src=\\"http://i743.photobucket.com/albums/xx76/coresteams/CUTS/sexy-lady-abstract-shadow.png\\" width=\\"10\\"> RESULTAT DES ELECTIONS</strong><br>Retrouvez le résultat des votes de Madame JUILLET sur les réseaux sociaux Madamesques :  Facebook, Google+ et Twitter.<br>Cliquez sur les petits icones à droite du logo et suivez-nous :)</p><p><strong><img src=\\"http://i743.photobucket.com/albums/xx76/coresteams/CUTS/sexy-lady-abstract-shadow.png\\" width=\\"10\\"> JULY, WHO IS THE #1 MADAME?</strong><br>Who has been elected Madame JULY? Discover it on social networks: Facebook, Google+ and Twitter.<br>Click on icons (next to our logo) and follow us :)</p></div>\\t\\t\\t\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t</div>\\n\\n\\n</div>\\n\\n\\t\\t\\n\\t\\t<div id=\\"footer\\">\\n\\t\\t\\t\\n\\t\\t\\t\\n<div id=\\"footer-end\\" class=\\"ruled-top\\">\\t \\n\\t\\t\\t\\t<ul id=\\"footer-links\\"><li><a href=\\"http://www.bonjourmadame.fr\\">bonjourmadame.fr</a></li>\\n\\t\\t\\t\\t\\t<li><a href=\\"http://www.bonjourmadame.us\\">bonjourmadame.us</a></li>\\n\\t\\t\\t\\t\\t<li><a href=\\"mailto:monsieur@bonjourmadame.fr\\">Contact : monsieur [at] bonjourmadame.fr</a></li>\\n                    <li><a href=\\"mailto:monsieur@bonjourmadame.fr\\">Vous voulez apparaître ici ?</a></li>\\n    \\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t</ul><a href=\\"http://bonplan1.com/fpage/rencontres-hard/d687301-pc/0/8/1141/102010/xflirt-v2.html\\" width=\\"728\\" height=\\"90\\" rel=\\"swf\\"></a><p class=\\"credits\\">Bonjour Madame, le seul et l\'unique depuis 2009 ! Préférez l\'original aux copies.  (version <a href=\\"http://www.pixelunion.net\\">pixel union</a>, sept.2012)</p>\\n                \\n                <ul class=\\"menu\\"><li><a class=\\"rss\\" href=\\"http://feeds2.feedburner.com/BonjourMadame\\"><span class=\\"label\\">RSS</span></a></li></ul></div>\\n\\t\\t</div>\\n\\t</div>\\n\\n\\n    \\n\\n\\n\\n\\n\\n\\n\\n\\n    \\n\\n</div>');
     $feedItem1BonjourMadame->setPublishedAt(new \DateTime('2013-09-06T07:50:00Z'));
     $feedItem1BonjourMadame->setFeed($this->getReference('feed-bonjourmadame'));
     $manager->persist($feedItem1BonjourMadame);
     $this->addReference('feeditem1-bonjourmadame', $feedItem1BonjourMadame);
     $feedItem2BonjourMadame = new FeedItem();
     $feedItem2BonjourMadame->setTitle('Naya');
     $feedItem2BonjourMadame->setLink('http://www.bonjourmadame.fr/post/60059225434/naya');
     $feedItem2BonjourMadame->setPermaLink('http://www.bonjourmadame.fr/post/60059225434');
     $feedItem2BonjourMadame->setContent('<div class=\\"content-500 menu-labels round-corners scale-images singular\\">\\n\\n\\n\\n<div id=\\"header\\" class=\\"pinned\\">\\n\\t\\t<div class=\\"inner\\">\\n\\t\\t\\t\\n            \\nLe site qui vous fera dire \\"Bonjour Madame !\\" - The site that makes you say \\"Bonjour Madame!\\"<br><strong>TOUS LES MATINS 10h, une nouvelle photo, une nouvelle fracture de l\'oeil - EVERY MORNING AT 10 (GMT +1), a new picture, a new eye fracture.</strong>\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\n\\t\\t\\t\\n\\n\\t\\t\\t\\n\\t\\t\\t<ul class=\\"menu\\"><li><a class=\\"archives\\" href=\\"http://www.bonjourmadame.fr/archive\\"><span class=\\"label\\">Archives</span></a></li>\\n                \\n                \\n                            \\n\\t\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t\\n                \\n                <li><a class=\\"random\\" href=\\"http://bonjour.plaisir-pour-tous.com/\\" title=\\"Shop\\"><span class=\\"label\\">Shop</span></a></li>\\n                <li><a class=\\"ask\\" href=\\"http://www.comboutique.com/shop/homeboutiquetsm2.php?shopid=35522\\" title=\\"Tee Shirt\\"><span class=\\"label\\">Tee Shirt</span></a></li>\\n                        \\n\\t\\t\\t</ul></div>\\n\\t\\t\\n\\t</div>\\n\\n\\t\\n\\t<div id=\\"page\\" class=\\"right-sidebar\\">\\n\\t\\t\\n\\t\\t<div class=\\"banner\\">\\n\\t\\t\\t<a href=\\"http://www.bonjourmadame.fr/\\" title=\\"Bonjour Madame\\"><img id=\\"banner\\" src=\\"http://static.tumblr.com/i4vyfyk/C4Cmbw5fi/bmlogo2.png\\" alt=\\"banner\\"></a> <a href=\\"http://www.facebook.com/pages/Bonjour-Madame/74408188101\\"><img src=\\"http://www.facebook.com/favicon.ico\\" width=\\"20\\"></a> <a href=\\"https://twitter.com/bonjour_madame\\"><img src=\\"http://www.combattrelaflemme.com/wp-content/uploads/2009/06/rsz_icon-twitter.png\\" width=\\"20\\"></a> <a href=\\"https://plus.google.com/102827775225273092690/\\"><img src=\\"http://2.bp.blogspot.com/-Srwi3RNi69w/TleLkHZUp8I/AAAAAAAAAjY/brBM1VjVbIU/s1600/google_plus_wallpaper-29.png\\" width=\\"20\\"></a>\\n\\t\\t</div>\\n\\t\\t\\n\\t\\t\\n\\t\\t<div id=\\"content\\">\\n\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t<div id=\\"post-60059225434\\" class=\\"post type-photo\\">\\n\\t\\t\\t\\t\\t<div class=\\"post-panel\\">\\n\\t\\t\\t\\t\\t\\t<div class=\\"media\\">\\n\\t\\t\\t\\t\\t\\t\\t<div class=\\"photo-panel\\">\\n\\n\\t\\t\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<a href=\\"http://www.bonjourmadame.fr/image/60059225434\\"><img src=\\"http://24.media.tumblr.com/22ccaceee31c0e27bf64ee1cf369902d/tumblr_msgwuz1UcE1qzy9ouo2_r1_500.jpg\\" alt=\\"Naya\\"></a>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\"photo-btns\\"><a class=\\"lightbox\\" href=\\"http://31.media.tumblr.com/22ccaceee31c0e27bf64ee1cf369902d/tumblr_msgwuz1UcE1qzy9ouo2_r1_1280.jpg\\">Pop-up</a><a class=\\"photo-url\\" href=\\"http://31.media.tumblr.com/22ccaceee31c0e27bf64ee1cf369902d/tumblr_msgwuz1UcE1qzy9ouo2_r1_1280.jpg\\">View Separately</a></div>\\n\\n\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t<div class=\\"copy\\">\\n\\t\\t\\t\\t\\t\\t\\t<p><a href=\\"http://photoport.deviantart.com/\\">Naya</a></p>\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t<div class=\\"meta\\">\\n\\t\\t\\t\\t\\t\\t\\t<ul class=\\"meta-list\\"><li class=\\"date\\"><a href=\\"http://www.bonjourmadame.fr/post/60059225434/naya\\" title=\\"Lun. septembre 2, 2013 @ 9:50 am\\">il y a 3 heures</a></li>\\n\\t\\t\\t\\t\\t\\t\\t\\t<li class=\\"notes\\"><a href=\\"http://www.bonjourmadame.fr/post/60059225434/naya#notes\\">32</a></li>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\t\\t<li class=\\"permalink\\"><a href=\\"http://www.bonjourmadame.fr/post/60059225434/naya\\">Permalien</a></li>\\n\\t\\t\\t\\t\\t\\t\\t\\t<li class=\\"share\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<a class=\\"share-btn\\" href=\\"http://tmblr.co/ZFByYytxpmrQ\\">J\'aime !</a>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\"share-box\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\"share-box-inside clearfix\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\"plusone-btn\\"></div>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<a href=\\"http://twitter.com/share\\" class=\\"twitter-share-button\\">Tweet</a>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\t\\t</li>\\n\\t\\t\\t\\t\\t\\t\\t</ul></div>\\n\\t\\t\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t</div>\\t\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\n\\t\\t\\t\\n\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t<div id=\\"pagination\\">\\n\\t\\t\\t\\t<div class=\\"nextprev\\">\\n\\t\\t\\t\\t\\t<span>← Précédent</span> <span class=\\"sep\\">•</span>\\n\\t\\t\\t\\t\\t<a class=\\"next\\" href=\\"http://www.bonjourmadame.fr/post/59949952433\\"><span>Suivant →</span></a>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t</div>\\n\\t\\t\\t\\n\\n\\t\\t</div>\\n\\n\\t\\t\\n                               \\n\\t\\t<div id=\\"sidebar\\">         \\n        \\n\\t\\t\\t<div id=\\"blog-info\\" class=\\"side-box\\">\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t<div class=\\"description\\">\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t<div><p><strong><img src=\\"http://i743.photobucket.com/albums/xx76/coresteams/CUTS/sexy-lady-abstract-shadow.png\\" width=\\"10\\"> RESULTAT DES ELECTIONS</strong><br>Retrouvez le résultat des votes de Madame JUILLET sur les réseaux sociaux Madamesques :  Facebook, Google+ et Twitter.<br>Cliquez sur les petits icones à droite du logo et suivez-nous :)</p><p><strong><img src=\\"http://i743.photobucket.com/albums/xx76/coresteams/CUTS/sexy-lady-abstract-shadow.png\\" width=\\"10\\"> JULY, WHO IS THE #1 MADAME?</strong><br>Who has been elected Madame JULY? Discover it on social networks: Facebook, Google+ and Twitter.<br>Click on icons (next to our logo) and follow us :)</p></div>\\t\\t\\t\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t</div>\\n\\n\\n</div>\\n\\n\\t\\t\\n\\t\\t<div id=\\"footer\\">\\n\\t\\t\\t\\n\\t\\t\\t\\n<div id=\\"footer-end\\" class=\\"ruled-top\\">\\t \\n\\t\\t\\t\\t<ul id=\\"footer-links\\"><li><a href=\\"http://www.bonjourmadame.fr\\">bonjourmadame.fr</a></li>\\n\\t\\t\\t\\t\\t<li><a href=\\"http://www.bonjourmadame.us\\">bonjourmadame.us</a></li>\\n\\t\\t\\t\\t\\t<li><a href=\\"mailto:monsieur@bonjourmadame.fr\\">Contact : monsieur [at] bonjourmadame.fr</a></li>\\n                    <li><a href=\\"mailto:monsieur@bonjourmadame.fr\\">Vous voulez apparaître ici ?</a></li>\\n    \\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t</ul><p class=\\"credits\\">Bonjour Madame, le seul et l\'unique depuis 2009 ! Préférez l\'original aux copies.  (version <a href=\\"http://www.pixelunion.net\\">pixel union</a>, sept.2012)</p>\\n                \\n                <ul class=\\"menu\\"><li><a class=\\"rss\\" href=\\"http://feeds2.feedburner.com/BonjourMadame\\"><span class=\\"label\\">RSS</span></a></li></ul></div>\\n\\t\\t</div>\\n\\t</div>\\n\\n\\n    \\n\\n\\n\\n\\n\\n\\n\\n\\n    \\n\\n</div>');
     $feedItem2BonjourMadame->setPublishedAt(new \DateTime('2013-09-02T07:50:00Z'));
     $feedItem2BonjourMadame->setFeed($this->getReference('feed-bonjourmadame'));
     $manager->persist($feedItem2BonjourMadame);
     $this->addReference('feeditem2-bonjourmadame', $feedItem2BonjourMadame);
     $manager->flush();
 }
コード例 #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $lock = new LockHandler($this->getName());
     if (!$lock->lock()) {
         $output->writeLn('<error>The command is already running in another process.</error>');
         return 0;
     }
     $feeds = array();
     $container = $this->getContainer();
     $dm = $container->get('doctrine.odm.mongodb.document_manager');
     // define host for generating route
     $context = $container->get('router')->getContext();
     $context->setHost($container->getParameter('domain'));
     $feedRepo = $dm->getRepository('Api43FeedBundle:Feed');
     $feedItemRepo = $dm->getRepository('Api43FeedBundle:FeedItem');
     $progress = $this->getHelperSet()->get('progress');
     // retrieve feed to work on
     if ($slug = $input->getOption('slug')) {
         $feed = $feedRepo->findOneBySlug($slug);
         if (!$feed) {
             return $output->writeLn('<error>Unable to find Feed document:</error> <comment>' . $slug . '</comment>');
         }
         $feeds = array($feed);
     } elseif (in_array($input->getOption('age'), array('new', 'old'))) {
         $feedsWithItems = $feedItemRepo->findAllFeedWithItems();
         // retrieve feed that HAVE items
         if ('old' == $input->getOption('age')) {
             $feeds = $feedRepo->findByIds($feedsWithItems, 'in');
         }
         // retrieve feeds that DOESN'T have items
         if ('new' == $input->getOption('age')) {
             $feeds = $feedRepo->findByIds($feedsWithItems, 'notIn');
         }
     } else {
         return $output->writeLn('<error>You must add some options to the task :</error> an <comment>age</comment> or a <comment>slug</comment>');
     }
     if ($input->getOption('with-trace')) {
         $output->writeln('<info>Feeds to check</info>: ' . count($feeds));
     }
     $totalCached = 0;
     $feedUpdated = array();
     foreach ($feeds as $feed) {
         if ($input->getOption('with-trace')) {
             $output->writeln('<info>Working on</info>: ' . $feed->getName() . ' (parser: <comment>' . $feed->getParser() . '</comment>)');
         }
         $rssFeed = $container->get('simple_pie_proxy')->setUrl($feed->getLink())->init();
         // update feed description, in case it was empty
         if (0 === strlen($feed->getDescription()) && 0 !== strlen($rssFeed->get_description())) {
             $feed->setDescription(html_entity_decode($rssFeed->get_description(), ENT_COMPAT, 'UTF-8'));
             $dm->persist($feed);
             $dm->flush($feed);
         }
         $parser = $container->get('content_extractor')->init($feed->getParser(), $feed, true);
         $cachedLinks = $feedItemRepo->getAllLinks($feed->getId());
         $cached = 0;
         // show progress bar in trace mode only
         if ($input->getOption('with-trace')) {
             $total = $rssFeed->get_item_quantity();
             $progress->start($output, $total);
         }
         foreach ($rssFeed->get_items() as $item) {
             // if an item already exists, we skip it
             // or if the item doesn't have a link, we won't cache it - will be useless
             if (isset($cachedLinks[$item->get_permalink()]) || null === $item->get_permalink()) {
                 continue;
             }
             $parsedContent = $parser->parseContent($item->get_permalink(), $item->get_description());
             // if readable content failed, use default one from feed item
             $content = $parsedContent->content;
             if (false === $content) {
                 $content = $item->get_content();
             }
             // if there is no date in the feed, we use the current one
             $date = $item->get_date();
             if (null === $date) {
                 $date = date('j F Y, g:i:s a');
             }
             $feedItem = new FeedItem();
             $feedItem->setTitle(html_entity_decode($item->get_title(), ENT_COMPAT, 'UTF-8'));
             $feedItem->setLink($parsedContent->url);
             $feedItem->setContent($content);
             $feedItem->setPermalink($item->get_permalink());
             $feedItem->setPublishedAt($date);
             $feedItem->setFeed($feed);
             $dm->persist($feedItem);
             ++$cached;
             if ($input->getOption('with-trace')) {
                 $progress->advance();
             }
         }
         if ($cached) {
             if ($input->getOption('with-trace')) {
                 $progress->finish();
             }
             // save the last time items where updated
             $feed->setLastItemCachedAt(date('j F Y, g:i:s a'));
             $dm->persist($feed);
             $totalCached += $cached;
             $feedLog = new FeedLog();
             $feedLog->setItemsNumber($cached);
             $feedLog->setFeed($feed);
             $dm->persist($feedLog);
             // store feed url updated, to ping hub later
             $feedUpdated[] = $feed->getSlug();
         }
         if ($input->getOption('with-trace')) {
             $output->writeln('<info>New cached items</info>: ' . $cached);
         }
         $dm->flush();
     }
     if (!empty($feedUpdated)) {
         if ($input->getOption('with-trace')) {
             $output->writeln('<info>Ping hubs...</info>');
         }
         // send an event about new feed updated
         $event = new FeedItemEvent($feedUpdated);
         $container->get('event_dispatcher')->dispatch(Api43FeedEvents::AFTER_ITEM_CACHED, $event);
     }
     $output->writeLn('<comment>' . $totalCached . '</comment> items cached.');
     // update nb items for each udpated feed
     foreach ($feedUpdated as $slug) {
         $feed = $feedRepo->findOneByslug($slug);
         $nbItems = $feedItemRepo->countByFeedId($feed->getId());
         $feed->setNbItems($nbItems);
         $dm->persist($feed);
         if ($input->getOption('with-trace')) {
             $output->writeln('<info>' . $feed->getName() . '</info> items updated: <comment>' . $nbItems . '</comment>');
         }
     }
     $dm->flush();
     $dm->clear();
 }