示例#1
0
文件: User.php 项目: nlegoff/statme
 /**
  * Handle get action
  * Get appropriate thread
  * @return Response
  */
 protected function get()
 {
     $parameter = $this->getRequest()->get('slug');
     if ($parameter === null) {
         throw new Http\BadRequest('Missing username parameter');
     }
     $criteria = array('slug' => $parameter);
     /** @var User */
     $user = $this->getEntityManager()->getRepository('Entity\\User')->findOneBy($criteria);
     if (!$user instanceof Entity\user) {
         throw new Http\NotFound('The requested user could not be found.');
     }
     $result = array('id' => $user->getId(), 'username' => $user->getUserName(), 'slug' => $user->getSlug(), 'email' => $user->getEmail(), 'first_name' => $user->getFirsName(), 'last_name' => $user->getLastName(), 'country' => $user->getCountry(), 'zip_code' => $user->getZipCode(), 'gender' => $user->getGender(), 'about' => $user->getAbout(), 'language' => $user->getLanguage(), 'last_update' => $user->lastUpdate(), 'registered' => $user->registeredDate(), 'birthday' => $user->birthdayDate(), 'notification_max_time' => $user->notificationMaxTime(), 'notification_min_time' => $user->notificationMinTime());
     $fieldSelection = $this->getFieldsSelection();
     $properResult = $this->properResult($fieldSelection, $result);
     return new Response(\Statme\Utils::json_encode($properResult), self::GET_OK, self::JSON_HEADERS);
 }
示例#2
0
文件: Thread.php 项目: nlegoff/statme
 public function __construct()
 {
     $this->subscriptions = new ArrayCollection();
     $this->alphaId = \Statme\Utils::alphaId();
 }
示例#3
0
 public function __construct()
 {
     $this->alphaId = \Statme\Utils::alphaId();
 }