Пример #1
0
 /**
  * @Route("/create", name="oro_issue_create")
  * @Template("OroIssueBundle:Issue:update.html.twig")
  */
 public function createAction()
 {
     $userId = $this->getRequest()->get('userId');
     $entity = new Issue();
     if ($userId) {
         $user = $this->getDoctrine()->getRepository('OroUserBundle:User')->find($userId);
         if (!$user) {
             throw new NotFoundHttpException(sprintf('User with ID %s is not found', $user));
         }
         $entity->setReporter($user);
     } elseif ($reporter = $this->getUser()) {
         $entity->setReporter($reporter);
     }
     $formAction = $this->get('oro_entity.routing_helper')->generateUrlByRequest('oro_issue_create', $this->getRequest());
     return $this->update($entity, $formAction);
 }