/**
  * Add a new Article or edit an existing Article
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 public function editAction()
 {
     $slug = $this->request->get('slug');
     if ($slug === null) {
         $article = new Article();
     } else {
         $article = $this->articleService->getArticleBySlug($slug);
         if (empty($article)) {
             return $this->redirect($this->generateUrl('article_dashboard'));
         }
     }
     $form = $this->createForm(new ArticleType(), $article);
     if ($this->request->isMethod('POST')) {
         $form->handleRequest($this->request);
         if ($form->isValid()) {
             $file = $form->get('file')->getData();
             $uniqueFileName = $this->uploadService->uploadFile($file);
             $article->setPictureName($uniqueFileName);
             $article->setAuthor($this->getUser());
             $this->articleService->save($article);
             return $this->redirect($this->generateUrl('article_view', array('slug' => $article->getSlug())));
         }
     }
     return $this->render('AppBundle:Article:edit.html.twig', array('form' => $form->createView()));
 }
 /**
  * Add a new tag to a specific article
  * @param Article $article
  * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function addAction(Article $article)
 {
     $tag = new Tag();
     $form = $this->createForm(new TagType(), $tag);
     if ($this->request->isMethod('POST')) {
         $form->handleRequest($this->request);
         if ($form->isValid()) {
             $slug = $this->request->get('slug');
             $article = $this->articleService->getArticleBySlug($slug);
             $tag->addArticle($article);
             $tag->setFrequency(15);
             $this->tagService->save($tag);
             return $this->redirect($this->generateUrl('tag_dashboard'));
         }
     }
     return $this->render('AppBundle:Tag:add.html.twig', array('form' => $form->createView()));
 }