/**
  * Update a comment into the database.
  *
  * @param \sellDreams\Domain\Basket $basket The comment to save
  */
 public function update(Basket $basket)
 {
     $this->getDb()->delete('t_basket', array('bas_id' => $basket->getId()));
     $basketData = array('usr_id' => $basket->getUsrid(), 'art_id' => $basket->getArtid(), 'bas_quantity' => $basket->getQuantity());
     $this->getDb()->insert('t_basket', $basketData);
     $id = $this->getDb()->lastInsertId();
     $basket->setId($id);
 }
 $article = $app['dao.article']->find($id);
 $commentFormView = null;
 $basketFormView = null;
 if ($app['security.authorization_checker']->isGranted('IS_AUTHENTICATED_FULLY')) {
     // A user is fully authenticated : he can add comments and article
     $user = $app['user'];
     $comment = new Comment();
     $comment->setArticle($article);
     $comment->setAuthor($user);
     $commentForm = $app['form.factory']->create(new CommentType(), $comment);
     $commentForm->handleRequest($request);
     $tmp = 2;
     $basket = $app['dao.basket']->findByUsrArt($user->getId(), $article->getId());
     if ($basket == null) {
         $tmp = 1;
         $basket = new Basket();
         $basket->setUsrid($user->getId());
         $basket->setArtid($article->getId());
     }
     $basketForm = $app['form.factory']->create(new BasketType(), $basket);
     $basketForm->handleRequest($request);
     if ($commentForm->isSubmitted() && $commentForm->isValid()) {
         $app['dao.comment']->save($comment);
         $app['session']->getFlashBag()->add('success', 'Votre commentaire a bien été ajouté');
     }
     if ($basketForm->isSubmitted() && $basketForm->isValid()) {
         if ($tmp != 1) {
             $app['dao.basket']->update($basket);
             $app['session']->getFlashBag()->add('success', "L'article a bien été modifié dans le panier");
         } else {
             $app['dao.basket']->save($basket);