/**
  * @Route("/importexcel", name="excel_import")
  */
 public function importExcelAction()
 {
     $filename = $this->get('kernel')->getRootDir() . '/../web/excel/test.xls';
     $lignes = $this->get('excel_service')->excel_to_array($filename);
     $em = $this->getDoctrine()->getManager();
     foreach ($lignes as $col) {
         $article = $em->getRepository('AppBundle:Article')->find($col['id']);
         if (!$article) {
             $article = new Article();
             $article->setTitle($col['title']);
             $article->setContent($col['content']);
             $article->setUrl($col['url']);
             $em->persist($article);
         } else {
             $article->setTitle($col['title']);
             $article->setContent($col['content']);
             $article->setUrl($col['url']);
         }
         $em->flush();
     }
     die;
 }
 /**
  * @Route("/importcsv", name="csv_import")
  */
 public function importCSVAction()
 {
     $filename = $this->get('kernel')->getRootDir() . '/../web/csv/test.csv';
     $header = array('id', 'title', 'content', 'url');
     $lignes = $this->get('csv_service')->csv_to_array($filename, ',', $header);
     $em = $this->getDoctrine()->getManager();
     foreach ($lignes as $col) {
         $article = $em->getRepository('AppBundle:Article')->find($col['id']);
         if (!$article) {
             $article = new Article();
             $article->setTitle($col['title']);
             $article->setContent($col['content']);
             $article->setUrl($col['url']);
             $em->persist($article);
         } else {
             $article->setTitle($col['title']);
             $article->setContent($col['content']);
             $article->setUrl($col['url']);
         }
         $em->flush();
     }
     die;
 }