Ejemplo n.º 1
0
 public function saveUser(User $user)
 {
     $userInfo = array('username' => $user->getUsername(), 'name' => $user->getName(), 'firstname' => $user->getFirstname(), 'password' => $user->getPassword(), 'role' => $user->getRole(), 'mail' => $user->getMail(), 'description' => $user->getDescription(), 'salt' => $user->getSalt(), 'tel' => $user->getTel(), 'dt_create' => $user->getDtCreate(), 'dt_update' => $user->getDtUpdate(), 'id_discipline' => $user->getDiscipline()->getIdDiscipline());
     //on modifie
     if ($user->getIdUsers()) {
         $this->getDb()->update('users', $userInfo, array('id_users' => $user->getIdUsers()));
     } else {
         $this->getDb()->insert('users', $userInfo);
         $id = $this->getDb()->lastInsertId();
         $user->setIdUsers($id);
     }
 }