Esempio n. 1
0
 public function transform(\Entity\User $user)
 {
     return ['id' => (int) $user->getUserId(), 'email' => $user->getEmail(), 'name' => $user->getName(), 'active' => $user->getActive(), 'group' => $user->getGroup(), 'links' => ['rel' => 'self', 'uri' => \Util\SlimUtil::absoluteUrlFor('user_by_id', ['id' => $user->getUserId()]), 'method' => 'GET']];
 }
Esempio n. 2
0
 /**
  * 
  * @param \Entity\User $user
  */
 public function update($user)
 {
     //password
     if (strlen($user->getPassword()) > 0) {
         $sql = 'UPDATE user SET name=:name, email=:email, password=:password, active=:active, `group`=:group WHERE user_id=:id';
     }
     // no password
     if (strlen($user->getPassword()) < 1) {
         $sql = 'UPDATE user SET name=:name, email=:email, active=:active, `group`=:group WHERE user_id=:id';
     }
     $stmt = $this->db->getConnection()->prepare($sql);
     // password
     if (strlen($user->getPassword()) > 0) {
         $stmt->bindParam('password', $user->getPassword());
     }
     $stmt->bindParam('name', $user->getName());
     $stmt->bindParam('email', $user->getEmail());
     $stmt->bindParam('active', $user->getActive());
     $stmt->bindParam('group', $user->getGroup());
     $stmt->bindParam('id', $user->getUserId());
     return $stmt->execute();
 }
Esempio n. 3
0
 /**
  * @return string
  */
 public function getName()
 {
     return $this->entity->getName();
 }