Browse Source

Vue supprimer

François 6 years ago
parent
commit
dca5866e52

+ 148 - 76
.idea/workspace.xml

@@ -2,17 +2,12 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="19fd33e1-3e6e-469c-a5f8-ac62ca30af41" name="Default Changelist" comment="">
-      <change afterPath="$PROJECT_DIR$/src/AppBundle/Controller/AjaxController.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/.settings/org.eclipse.wst.validation.prefs" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/app/Resources/views/base.html.twig" beforeDir="false" afterPath="$PROJECT_DIR$/app/Resources/views/base.html.twig" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/app/config/config.yml" beforeDir="false" afterPath="$PROJECT_DIR$/app/config/config.yml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/composer.json" beforeDir="false" afterPath="$PROJECT_DIR$/composer.json" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/composer.lock" beforeDir="false" afterPath="$PROJECT_DIR$/composer.lock" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/AppBundle/Controller/DefaultController.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/AppBundle/Controller/DefaultController.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/AppBundle/Controller/AjaxController.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/AppBundle/Controller/AjaxController.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/src/AppBundle/Controller/VideothequeController.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/AppBundle/Controller/VideothequeController.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/AppBundle/Entity/Film.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/AppBundle/Entity/Film.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/AppBundle/Repository/RealisateurRepository.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/AppBundle/Repository/RealisateurRepository.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/base.html.twig" beforeDir="false" afterPath="$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/base.html.twig" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/supprimer.html.twig" beforeDir="false" afterPath="$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/supprimer.html.twig" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/testajax.html.twig" beforeDir="false" afterPath="$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/testajax.html.twig" afterDir="false" />
     </list>
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
     <option name="SHOW_DIALOG" value="false" />
@@ -27,38 +22,39 @@
     <session id="1841614210">
       <usages-collector id="statistics.lifecycle.project">
         <counts>
-          <entry key="project.closed" value="1" />
+          <entry key="project.closed" value="2" />
           <entry key="project.open.time.11" value="1" />
+          <entry key="project.open.time.12" value="1" />
           <entry key="project.open.time.5" value="1" />
-          <entry key="project.opened" value="2" />
+          <entry key="project.opened" value="3" />
         </counts>
       </usages-collector>
       <usages-collector id="statistics.file.extensions.open">
         <counts>
           <entry key="json" value="1" />
-          <entry key="php" value="1" />
-          <entry key="twig" value="3" />
+          <entry key="php" value="3" />
+          <entry key="twig" value="8" />
           <entry key="yml" value="2" />
         </counts>
       </usages-collector>
       <usages-collector id="statistics.file.types.open">
         <counts>
           <entry key="JSON" value="1" />
-          <entry key="PHP" value="1" />
-          <entry key="Twig" value="3" />
+          <entry key="PHP" value="3" />
+          <entry key="Twig" value="8" />
           <entry key="YAML" value="2" />
         </counts>
       </usages-collector>
       <usages-collector id="statistics.file.extensions.edit">
         <counts>
-          <entry key="php" value="383" />
-          <entry key="twig" value="9" />
+          <entry key="php" value="863" />
+          <entry key="twig" value="471" />
         </counts>
       </usages-collector>
       <usages-collector id="statistics.file.types.edit">
         <counts>
-          <entry key="PHP" value="383" />
-          <entry key="Twig" value="9" />
+          <entry key="PHP" value="863" />
+          <entry key="Twig" value="471" />
         </counts>
       </usages-collector>
       <usages-collector id="statistics.vcs.git.usages" />
@@ -75,51 +71,86 @@
       <file pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/src/AppBundle/Controller/VideothequeController.php">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="90">
-              <caret line="6" column="45" selection-start-line="6" selection-start-column="45" selection-end-line="6" selection-end-column="45" />
+            <state relative-caret-position="276">
+              <caret line="110" column="31" selection-start-line="110" selection-start-column="31" selection-end-line="110" selection-end-column="31" />
               <folding>
-                <element signature="e#1385#1404#1#PHP" expanded="true" />
-                <element signature="e#1744#1760#1#PHP" expanded="true" />
-                <element signature="e#2111#2130#1#PHP" expanded="true" />
+                <element signature="e#40#97#0#PHP" expanded="true" />
+                <element signature="e#2343#2359#1#PHP" expanded="true" />
               </folding>
             </state>
           </provider>
         </entry>
       </file>
-      <file pinned="false" current-in-tab="true">
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/supprimer.html.twig">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="111">
+              <caret line="9" column="43" selection-start-line="9" selection-start-column="43" selection-end-line="9" selection-end-column="43" />
+              <folding>
+                <element signature="e#12#43#0#Twig" expanded="true" />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/modifier.html.twig">
+          <provider selected="true" editor-type-id="text-editor">
+            <state>
+              <folding>
+                <element signature="e#12#26#0#Twig" expanded="true" />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/src/AppBundle/Controller/AjaxController.php">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="180">
-              <caret line="21" column="9" selection-start-line="21" selection-start-column="9" selection-end-line="21" selection-end-column="9" />
+            <state relative-caret-position="270">
+              <caret line="22" column="43" selection-start-line="22" selection-start-column="43" selection-end-line="22" selection-end-column="43" />
               <folding>
                 <element signature="e#40#73#0#PHP" expanded="true" />
-                <element signature="e#911#934#1#PHP" expanded="true" />
               </folding>
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/app/config/routing.yml">
+        <entry file="file://$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/testajax.html.twig">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="45">
-              <caret line="3" lean-forward="true" selection-start-line="3" selection-end-line="3" />
+            <state relative-caret-position="510">
+              <caret line="34" column="55" selection-start-line="34" selection-start-column="55" selection-end-line="34" selection-end-column="55" />
+              <folding>
+                <element signature="e#1014#1026#0#Twig" expanded="true" />
+              </folding>
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/ajouter.html.twig">
+        <entry file="file://$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/base.html.twig">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="75">
+              <caret line="5" selection-start-line="5" selection-end-line="5" />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="true">
+        <entry file="file://$PROJECT_DIR$/app/Resources/views/base.html.twig">
           <provider selected="true" editor-type-id="text-editor">
             <state relative-caret-position="105">
-              <caret line="7" lean-forward="true" selection-start-line="7" selection-end-line="7" />
-              <folding>
-                <element signature="e#12#43#0#Twig" expanded="true" />
-              </folding>
+              <caret line="26" column="37" selection-start-line="26" selection-start-column="37" selection-end-line="26" selection-end-column="37" />
             </state>
           </provider>
         </entry>
       </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/AppBundle/Tests/Controller/AjaxControllerTest.php">
+          <provider selected="true" editor-type-id="text-editor" />
+        </entry>
+      </file>
     </leaf>
   </component>
   <component name="Git.Settings">
@@ -128,10 +159,12 @@
   <component name="IdeDocumentHistory">
     <option name="CHANGED_PATHS">
       <list>
-        <option value="$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/testajax.html.twig" />
         <option value="$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/base.html.twig" />
-        <option value="$PROJECT_DIR$/src/AppBundle/Controller/VideothequeController.php" />
         <option value="$PROJECT_DIR$/src/AppBundle/Controller/AjaxController.php" />
+        <option value="$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/testajax.html.twig" />
+        <option value="$PROJECT_DIR$/src/AppBundle/Controller/VideothequeController.php" />
+        <option value="$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/supprimer.html.twig" />
+        <option value="$PROJECT_DIR$/app/Resources/views/base.html.twig" />
       </list>
     </option>
   </component>
@@ -214,7 +247,14 @@
               <item name="films" type="b2602c69:ProjectViewProjectNode" />
               <item name="films" type="462c0819:PsiDirectoryNode" />
               <item name="app" type="462c0819:PsiDirectoryNode" />
-              <item name="config" type="462c0819:PsiDirectoryNode" />
+              <item name="Resources" type="462c0819:PsiDirectoryNode" />
+            </path>
+            <path>
+              <item name="films" type="b2602c69:ProjectViewProjectNode" />
+              <item name="films" type="462c0819:PsiDirectoryNode" />
+              <item name="app" type="462c0819:PsiDirectoryNode" />
+              <item name="Resources" type="462c0819:PsiDirectoryNode" />
+              <item name="views" type="462c0819:PsiDirectoryNode" />
             </path>
             <path>
               <item name="films" type="b2602c69:ProjectViewProjectNode" />
@@ -258,6 +298,21 @@
               <item name="views" type="462c0819:PsiDirectoryNode" />
               <item name="videotheque" type="462c0819:PsiDirectoryNode" />
             </path>
+            <path>
+              <item name="films" type="b2602c69:ProjectViewProjectNode" />
+              <item name="films" type="462c0819:PsiDirectoryNode" />
+              <item name="src" type="462c0819:PsiDirectoryNode" />
+              <item name="AppBundle" type="462c0819:PsiDirectoryNode" />
+              <item name="Tests" type="462c0819:PsiDirectoryNode" />
+            </path>
+            <path>
+              <item name="films" type="b2602c69:ProjectViewProjectNode" />
+              <item name="films" type="462c0819:PsiDirectoryNode" />
+              <item name="src" type="462c0819:PsiDirectoryNode" />
+              <item name="AppBundle" type="462c0819:PsiDirectoryNode" />
+              <item name="Tests" type="462c0819:PsiDirectoryNode" />
+              <item name="Controller" type="462c0819:PsiDirectoryNode" />
+            </path>
           </expand>
           <select />
         </subPane>
@@ -293,18 +348,19 @@
       <option name="presentableId" value="Default" />
       <updated>1539955568381</updated>
       <workItem from="1539955571597" duration="339000" />
-      <workItem from="1539955933558" duration="1424000" />
+      <workItem from="1539955933558" duration="3651000" />
+      <workItem from="1540032947542" duration="1972000" />
     </task>
     <servers />
   </component>
   <component name="TimeTrackingManager">
-    <option name="totallyTimeSpent" value="1763000" />
+    <option name="totallyTimeSpent" value="5962000" />
   </component>
   <component name="ToolWindowManager">
     <frame x="0" y="27" width="1366" height="741" extended-state="6" />
     <editor active="true" />
     <layout>
-      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.25" />
+      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.25378788" />
       <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
       <window_info id="Favorites" order="2" side_tool="true" />
       <window_info anchor="bottom" id="Message" order="0" />
@@ -332,78 +388,94 @@
     <option name="myLimit" value="2678400000" />
   </component>
   <component name="editorHistoryManager">
-    <entry file="file://$PROJECT_DIR$/.project">
+    <entry file="file://$PROJECT_DIR$/.project" />
+    <entry file="file://$PROJECT_DIR$/.buildpath" />
+    <entry file="file://$PROJECT_DIR$/package.json" />
+    <entry file="file://$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/ajouter.html.twig">
       <provider selected="true" editor-type-id="text-editor">
-        <state>
-          <caret selection-end-line="22" />
+        <state relative-caret-position="105">
+          <caret line="7" lean-forward="true" selection-start-line="7" selection-end-line="7" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/.buildpath">
-      <provider selected="true" editor-type-id="text-editor" />
+    <entry file="file://$PROJECT_DIR$/app/config/routing.yml">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="45">
+          <caret line="3" lean-forward="true" selection-start-line="3" selection-end-line="3" />
+        </state>
+      </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/package.json">
-      <provider selected="true" editor-type-id="text-editor" />
+    <entry file="file://$PROJECT_DIR$/src/AppBundle/Tests/Controller/videothequeControllerTest.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="-90" />
+      </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/base.html.twig">
+    <entry file="file://$PROJECT_DIR$/src/AppBundle/Controller/AjaxController.php">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="75">
-          <caret line="5" lean-forward="true" selection-start-line="5" selection-end-line="5" />
+        <state relative-caret-position="270">
+          <caret line="22" column="43" selection-start-line="22" selection-start-column="43" selection-end-line="22" selection-end-column="43" />
           <folding>
-            <element signature="e#12#26#0#Twig" expanded="true" />
+            <element signature="e#40#73#0#PHP" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/testajax.html.twig">
+    <entry file="file://$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/base.html.twig">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="202">
-          <caret line="71" column="9" lean-forward="true" selection-start-line="71" selection-start-column="9" selection-end-line="71" selection-end-column="9" />
-          <folding>
-            <element signature="e#12#43#0#Twig" expanded="true" />
-          </folding>
+        <state relative-caret-position="75">
+          <caret line="5" selection-start-line="5" selection-end-line="5" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/ajouter.html.twig">
+    <entry file="file://$PROJECT_DIR$/src/AppBundle/Tests/Controller/AjaxControllerTest.php">
+      <provider selected="true" editor-type-id="text-editor" />
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/testajax.html.twig">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="105">
-          <caret line="7" lean-forward="true" selection-start-line="7" selection-end-line="7" />
+        <state relative-caret-position="510">
+          <caret line="34" column="55" selection-start-line="34" selection-start-column="55" selection-end-line="34" selection-end-column="55" />
           <folding>
-            <element signature="e#12#43#0#Twig" expanded="true" />
+            <element signature="e#1014#1026#0#Twig" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/app/config/routing.yml">
+    <entry file="file://$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/modifier.html.twig">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="45">
-          <caret line="3" lean-forward="true" selection-start-line="3" selection-end-line="3" />
+        <state>
+          <folding>
+            <element signature="e#12#26#0#Twig" expanded="true" />
+          </folding>
         </state>
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/src/AppBundle/Controller/VideothequeController.php">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="90">
-          <caret line="6" column="45" selection-start-line="6" selection-start-column="45" selection-end-line="6" selection-end-column="45" />
+        <state relative-caret-position="276">
+          <caret line="110" column="31" selection-start-line="110" selection-start-column="31" selection-end-line="110" selection-end-column="31" />
           <folding>
-            <element signature="e#1385#1404#1#PHP" expanded="true" />
-            <element signature="e#1744#1760#1#PHP" expanded="true" />
-            <element signature="e#2111#2130#1#PHP" expanded="true" />
+            <element signature="e#40#97#0#PHP" expanded="true" />
+            <element signature="e#2343#2359#1#PHP" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/AppBundle/Controller/AjaxController.php">
+    <entry file="file://$PROJECT_DIR$/src/AppBundle/Resources/views/videotheque/supprimer.html.twig">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="180">
-          <caret line="21" column="9" selection-start-line="21" selection-start-column="9" selection-end-line="21" selection-end-column="9" />
+        <state relative-caret-position="111">
+          <caret line="9" column="43" selection-start-line="9" selection-start-column="43" selection-end-line="9" selection-end-column="43" />
           <folding>
-            <element signature="e#40#73#0#PHP" expanded="true" />
-            <element signature="e#911#934#1#PHP" expanded="true" />
+            <element signature="e#12#43#0#Twig" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
+    <entry file="file://$PROJECT_DIR$/app/Resources/views/base.html.twig">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="105">
+          <caret line="26" column="37" selection-start-line="26" selection-start-column="37" selection-end-line="26" selection-end-column="37" />
+        </state>
+      </provider>
+    </entry>
   </component>
 </project>

+ 5 - 5
app/Resources/views/base.html.twig

@@ -18,13 +18,13 @@
 		</div>
 		<main>
 			<div class="row">
-				<nav class="flex-column col-md-4">
-					<ul>
-						<li><a href="{{ path('videotheque_ajouter') }}">Ajouter un film</a></li>
-						<li>Un autre élément de menu</li>
+				<nav class="col-md-2">
+					<ul class="nav flex-column">
+						<li class="nav-item"><a class="nav-link" href="{{  path('videotheque_liste') }}">Liste des films</a></li>
+						<li class="nav-item"><a class="nav-link" href="{{ path('videotheque_ajouter') }}">Ajouter un film</a></li>
 					</ul>	
 				</nav>
-				<div class="col-md-8">
+				<div class="col-md-10">
 					{% for message in app.flashes('success') %}
 					<div class="alert alert-warning alert-dismissible fade show" role="alert">
   						<strong>Cool</strong> {{ message }}

+ 7 - 12
src/AppBundle/Controller/AjaxController.php

@@ -15,31 +15,26 @@ class AjaxController extends Controller
      */
     public function ajaxAction (Request $request)
     {
-        $realisateur = new Realisateur();
-        $realisateur->setNom('Drouhard');
-        $realisateur->setPrenom('François');
 
-        $realisateur = $this->get('serializer')->serialize($realisateur, 'json');
-        return new JsonResponse($realisateur);
+        return $this->render('@App/videotheque/testajax.html.twig');
     }
 
     /**
-     * @Route("/rqajax", name="ajax_requete_ajax")
+     * @Route("/rqajax", name="ajax_requete")
      */
     public function requeteAjaxAction(Request $request)
     {
-        $em = $this->getDoctrine()->getManager();
-        $repo = $em->getRepository('AppBundle:Realisateur');
-        $resultats = $repo->findByNom($request->request->get('mot_cle'));
         if ($request->isXmlHttpRequest())
         {
+            $em = $this->getDoctrine()->getManager();
+            $repo = $em->getRepository('AppBundle:Realisateur');
+            $resultats = $repo->findByNom($request->request->get('mot_cle'));
             foreach ($resultats as $key=>$realisateur) {
                 $resultats[$key] = $this->get('serializer')->serialize($realisateur, 'json');
             }
             return new JsonResponse($resultats);
         }
-        return $this->render ('@App/videotheque/testajax.html.twig', array (
-            'realisateurs' => $resultats
-        ));
+
+        return $this->redirectToRoute('ajax_recherche');
     }
 }

+ 15 - 1
src/AppBundle/Controller/VideothequeController.php

@@ -93,8 +93,22 @@ class VideothequeController extends Controller
 	 */
 	public function supprimerAction($id)
 	{
+	    $em = $this->getDoctrine()->getManager();
+	    $repo = $em->getRepository('AppBundle:Film');
+        $film = $repo->find($id);
+
+        $form = $this->get('form.factory')->create();
+        if ($form->isSubmitted() && $form->isValid())
+        {
+            $em->remove($film);
+            $em->flush();
+            $this->addFlash('success', "Le film \"$film\" a bien été supprimé.");
+            return $this->redirectToRoute('videotheque_liste');
+        }
+
 		return $this->render('@App/videotheque/supprimer.html.twig', array(
-			// ...
+			'film'  =>  $film,
+            'form'  =>  $form->createView()
 		));
 	}
 

+ 15 - 3
src/AppBundle/Resources/views/videotheque/supprimer.html.twig

@@ -1,7 +1,19 @@
-{% extends "base.html.twig" %}
+{% extends "@App/videotheque/base.html.twig" %}
 
-{% block title %}AppBundle:videotheque:supprimer{% endblock %}
+{% block title %}Supprimer un film{% endblock %}
+{% block titre %}{{ parent() }} - Supprimer{% endblock %}
 
 {% block body %}
-<h1>Welcome to the videotheque:supprimer page</h1>
+    <h2>Confirmation ?</h2>
+    <p>Êtes vous certain de vouloir supprimer le film "{{ film.titre }}" ?</p>
+    <form action="{{ path('videotheque_supprimer', {'id': film.id}) }}" method="post">
+        <a href="{{ path('videotheque_liste', {'id': film.id}) }}" class="btn btn-default">
+            <i class="fas fa-chevron-circle-left"></i>
+            Retour à la liste des films
+        </a>
+        {# Ici j'ai écrit le bouton de soumission à la main #}
+        <input type="submit" value="Supprimer" class="btn btn-danger" />
+        {# Ceci va générer le champ CSRF #}
+        {{ form_rest(form) }}
+    </form>
 {% endblock %}

+ 2 - 4
src/AppBundle/Resources/views/videotheque/testajax.html.twig

@@ -12,9 +12,7 @@
 
 <div id="results">
     <ul class="result">
-    {% for realisateur in realisateurs %}
-        <li><a id="resultats_ville" href="#"></a></li>
-    {% endfor %}
+
     </ul>
 </div>
 {% endblock %}
@@ -34,7 +32,7 @@ $(document).ready( function() {
                     setTimeout(function() {
                         $.ajax({
                             type: 'POST',
-                            url: "{{ path('videotheque_requete_ajax') }}",
+                            url: "{{ path('ajax_requete') }}",
                             data: 'mot_cle=' + contenu,
                             success: function (data) {
                                 jQuery('body').addClass('searching');