Advertisement
Guest User

Untitled

a guest
Feb 20th, 2013
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.80 KB | None | 0 0
  1.    public function uploadAction() {
  2.  
  3.         $document = new \Repo\RepoBundle\Entity\RepoFile();
  4.         $document->setAuthor(4449);
  5.  
  6.         $form = $this->createFormBuilder($document)
  7.                 ->add('file')
  8.                 ->getForm()
  9.         ;
  10.  
  11.  
  12.         if ($this->getRequest()->isMethod('POST')) {
  13.  
  14.             $form->bind($this->getRequest());
  15.             if ($form->isValid()) {
  16.  
  17.                 $em = $this->getDoctrine()->getManager();
  18.                                 var_dump($document->author);
  19.                 $em->persist($document);
  20.                 $em->flush();
  21.  
  22.                 return $this->redirect('Repo_Strategy_upload');
  23.             }
  24.         }
  25.  
  26.         return $this->render('RepoRepoBundle:Strategy:upload.html.twig', array('form' => $form->createView()));
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement