]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Controller/EntryController.php
CS
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Controller / EntryController.php
index 89677befb6c347a003429513392254ee2fe1e00c..7fd982c903e82e66f0789125bedd62ffba616d5e 100644 (file)
@@ -7,7 +7,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
 use Symfony\Component\HttpFoundation\Request;
 use Wallabag\CoreBundle\Entity\Entry;
 use Wallabag\CoreBundle\Service\Extractor;
-use Wallabag\CoreBundle\Helper\Url;
+use Wallabag\CoreBundle\Form\Type\EntryType;
 
 class EntryController extends Controller
 {
@@ -22,10 +22,7 @@ class EntryController extends Controller
     {
         $entry = new Entry($this->getUser());
 
-        $form = $this->createFormBuilder($entry)
-            ->add('url', 'url')
-            ->add('save', 'submit')
-            ->getForm();
+        $form = $this->createForm(new EntryType(), $entry);
 
         $form->handleRequest($request);
 
@@ -53,7 +50,7 @@ class EntryController extends Controller
     }
 
     /**
-     * Shows unread entries for current user
+     * Shows unread entries for current user.
      *
      * @Route("/unread", name="unread")
      *
@@ -73,7 +70,7 @@ class EntryController extends Controller
     }
 
     /**
-     * Shows read entries for current user
+     * Shows read entries for current user.
      *
      * @Route("/archive", name="archive")
      *
@@ -93,7 +90,7 @@ class EntryController extends Controller
     }
 
     /**
-     * Shows starred entries for current user
+     * Shows starred entries for current user.
      *
      * @Route("/starred", name="starred")
      *
@@ -113,7 +110,7 @@ class EntryController extends Controller
     }
 
     /**
-     * Shows entry content
+     * Shows entry content.
      *
      * @param Entry $entry
      *
@@ -132,7 +129,7 @@ class EntryController extends Controller
     }
 
     /**
-     * Changes read status for an entry
+     * Changes read status for an entry.
      *
      * @param Request $request
      * @param Entry   $entry
@@ -157,7 +154,7 @@ class EntryController extends Controller
     }
 
     /**
-     * Changes favorite status for an entry
+     * Changes favorite status for an entry.
      *
      * @param Request $request
      * @param Entry   $entry
@@ -182,7 +179,7 @@ class EntryController extends Controller
     }
 
     /**
-     * Deletes entry
+     * Deletes entry.
      *
      * @param Request $request
      * @param Entry   $entry
@@ -195,8 +192,9 @@ class EntryController extends Controller
     {
         $this->checkUserAction($entry);
 
-        $entry->setDeleted(1);
-        $this->getDoctrine()->getManager()->flush();
+        $em = $this->getDoctrine()->getManager();
+        $em->remove($entry);
+        $em->flush();
 
         $this->get('session')->getFlashBag()->add(
             'notice',
@@ -207,7 +205,7 @@ class EntryController extends Controller
     }
 
     /**
-     * Check if the logged user can manage the given entry
+     * Check if the logged user can manage the given entry.
      *
      * @param Entry $entry
      */