Beispiel #1
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();
 }
 public function getGroup()
 {
     $this->__load();
     return parent::getGroup();
 }
Beispiel #3
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']];
 }
 /**
  * {@inheritDoc}
  */
 public function getGroup()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getGroup', []);
     return parent::getGroup();
 }