コード例 #1
0
 /**
  * Try user to log in.
  *
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 public function loginAction(Request $request)
 {
     $data = $request->request->all();
     $user = new User();
     $user->load($data['email'], 'email');
     if (!empty($user->getId()) && $user->getPassword() == md5($data['pass'])) {
         $request->getSession()->set('userId', $user->getId());
         $request->getSession()->set('userName', $user->getName());
         $request->getSession()->set('userSName', $user->getSecondName());
         $request->getSession()->set('userRole', $user->getRoleId());
         return $this->redirectToRoute('home');
     }
     $request->getSession()->set('message', 'User with current login and password not found.');
     return $this->redirectToRoute('lance_authorization');
 }
コード例 #2
0
 public function fullLoad()
 {
     if ($this->getUserId()) {
         $user = new User();
         $user->load($this->getUserId());
         $this->setUserName($user->getName() . ' ' . $user->getSecondName());
     }
     if ($this->getPatientId()) {
         $patient = new Patient();
         $patient->load($this->getPatientId());
         $this->setPatientName($patient->getName() . ' ' . $patient->getSecondName());
     }
     if ($this->getDiseaseId()) {
         $disease = new Disease();
         $disease->load($this->getDiseaseId());
         $this->setTitle($disease->getTitle());
     }
 }
コード例 #3
0
 public function fullLoad()
 {
     if ($this->getUserId()) {
         $user = new User();
         $user->load($this->getUserId());
         $this->setUserName($user->getName() . ' ' . $user->getSecondName());
     }
     if ($this->getPatientId()) {
         $patient = new Patient();
         $patient->load($this->getPatientId());
         $this->setPatientName($patient->getName() . ' ' . $patient->getSecondName());
     }
     if ($this->getServiceId()) {
         $service = new Service();
         $service->load($this->getServiceId());
         $this->setTitle($service->getTitle());
         $this->setPrice($service->getPrice());
     }
 }