Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function updateDocumentAction(Request $requette, $id){
- //identifiant du document
- if (!$id) {
- throw $this->createNotFoundException(
- "Aucun identifiant n'a été fourni"
- );
- }
- // Manager
- $em = $this -> getDoctrine() -> getManager();
- /*
- * Document dans la base
- */
- $document = $em -> getRepository("AdminBundle:Document") -> find($id);
- if (!$document) {
- throw $this->createNotFoundException(
- 'Ce Document n\'existe pas'
- );
- }
- $formulaire = $this->createForm(new DocumentType(), $document);
- //si un formulaire est transmis
- $formulaire -> handleRequest($requette);
- if ($formulaire->isValid()) {
- $em->flush();
- //var_dump("echo expression");
- // return $this->redirect($this->generateUrl('admin_documents'));
- }
- // Formulaire avec données
- return $this -> render(
- 'AdminBundle:Documents:update-document.html.twig' ,
- array('formulaire' => $formulaire -> createView())
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement