/** * @return News */ protected function generateNewsList() { $newsList = array(); $data = array(array('01', '2015-02-03 10:00', NULL), array('02', '2015-02-10 23:00', NULL), array('03', '2015-02-12 11:30', NULL), array('04', '2015-02-20 08:30', NULL), array('05', '2015-02-20 09:30', NULL), array('06', '2015-02-20 10:30', NULL), array('07', '2015-02-21 07:30', NULL), array('08', '2015-02-23 14:30', NULL), array('09', '2015-02-25 17:30', NULL), array('10', '2015-02-26 18:30', NULL), array('11', '2015-02-27 21:30', NULL), array('12', '2015-02-28 22:00', NULL), array('13', '2015-01-30 22:00', '2015-02-07 10:00'), array('14', '2015-01-28 22:00', '2015-03-02 11:00'), array('15', '2015-02-14 12:00', '2015-03-05 11:00'), array('16', '2015-02-19 15:00', '2015-02-22 11:00'), array('17', '2015-01-28 15:00', '2015-01-29 11:00'), array('18', '2015-03-01 15:00', '2015-03-02 11:00')); foreach ($data as $item) { $news = new News(); $news->setTitle($item[0]); $beginDate = new \DateTime($item[1]); $news->setDatetime($beginDate); if (!is_null($item[2])) { $endDate = new \DateTime($item[2]); $news->setEventEnd($endDate); } $newsList[] = $news; } return $newsList; }