コード例 #1
0
 public function process()
 {
     if ($this->submitDatas === null) {
         throw new \Exception("You must bind datas before process");
     }
     if (!$this->validator->isValide()) {
         throw new \Exception($this->validator->getErrors(), $this->validator->getValidationCode());
     }
     $this->createUser();
     if (!$this->newUser || !$this->newUser->getId()) {
         throw new \Exception(json_encode(array("error" => "Erreur serveur, veuillez réessayer ultérieurement.")), 500);
     }
     return $this->getUserInJson();
 }
コード例 #2
0
ファイル: UserWS.php プロジェクト: pigroupe/SfynxAuthBundle
 /**
  * @return array
  */
 public function jsonSerialize()
 {
     $userInArray = array('isconnected' => $this->user->isConnected($this->expired), 'userid' => $this->user->getId(), 'enabled' => $this->user->getEnabled(), 'username' => $this->user->getUserName(), 'lastname' => $this->user->getName() ? $this->user->getName() : $this->user->getUserName(), 'firstname' => $this->user->getNickname(), 'email' => $this->user->getEmail(), 'address' => $this->user->getAddress(), 'cp' => $this->user->getZipCode(), 'city' => $this->user->getCity(), 'country' => $this->user->getCountry(), 'lang_code' => $this->user->getLangCode() instanceof Langue ? $this->user->getLangCode()->getId() : "", 'birthday' => $this->user->getBirthday(), 'global_optin' => $this->user->getGlobalOptIn(), 'site_optin' => $this->user->getSiteOptIn(), 'created_at' => $this->user->getCreatedAt(), 'updated_at' => $this->user->getUpdatedAt(), 'error' => $this->getError());
     return json_encode($userInArray);
 }