Пример #1
0
 /**
  * @ORM\PreUpdate
  */
 public function preUpdate()
 {
     $this->updatedAt = new \Datetime();
     $currentUser = Util::getCurrentUser();
     if ($currentUser) {
         $this->updatedBy = $currentUser->getId();
     } else {
         $this->updatedBy = 999999999;
     }
 }
 /**
  * タイプの傾向
  *
  * @Route("/trend_enneagram", name="trend_enneagram_option")
  * @Method("GET")
  * @Template("AwEventBundle:Common:typeTrend.html.twig")
  */
 public function typeTrendAction()
 {
     $userId = Util::getCurrentUser()->getId();
     $this->setBreadcrumbList('trend_enneagram_option', $userId, 2);
     return array();
 }
 /**
  * 登録処理
  *
  * @Route("/user_create", name="user_create")
  * @Method("POST")
  */
 public function userCreateAction(Request $request)
 {
     $user = new User();
     $userRole = new UserRole();
     if ($request->getSession()->has('conf_new_user')) {
         $em = $this->getDoctrine()->getManager();
         $data = $request->getSession()->get('conf_new_user');
         $user->setUserRole($userRole);
         $userRole->setMstRoleId(2);
         // パスワード暗号化
         $data['password']['first'] = Util::encodePassword($data['password']['first']);
         $data['password']['second'] = Util::encodePassword($data['password']['second']);
         $form = $this->createUserNewForm($user);
         $form->submit($data);
         $em->persist($user);
         $em->flush();
         $msg = $this->get('translator')->trans('com_message.createOK');
         $request->getSession()->getFlashBag()->set('info', $msg);
         return $this->redirectToRoute('user_index');
     }
 }