Example #1
0
 public function save(Adherent $adherent, User $usernow)
 {
     $datenow = date("Y-m-d H:i:s");
     $adherentData = array('adh_civilite' => $adherent->getCivilite(), 'adh_nom' => $adherent->getNom(), 'adh_prenom' => $adherent->getPrenom(), 'adh_groupe' => $adherent->getGroupe(), 'adh_adresse' => $adherent->getAdresse(), 'adh_codepostal' => $adherent->getCodePostal(), 'adh_ville' => $adherent->getVille(), 'adh_departement' => $adherent->getDepartement(), 'adh_pays' => $adherent->getPays(), 'adh_email' => $adherent->getEmail(), 'adh_phone' => $adherent->getPhone(), 'adh_mobile' => $adherent->getMobile(), 'adh_datelastmod' => $datenow, 'int_user_lastmodauteur' => $usernow->getId(), 'adh_isajour' => $adherent->getIsajour());
     if ($adherent->getId()) {
         $this->getDb()->update('t_adherent', $adherentData, array('adh_id' => $adherent->getId()));
     } else {
         $adherentData2 = array('adh_datecreation' => $datenow, 'int_user_auteur' => $usernow->getId());
         $adherentDatatot = $adherentData + $adherentData2;
         $this->getDb()->insert('t_adherent', $adherentDatatot);
         $id = $this->getDb()->lastInsertId();
         $adherent->setId($id);
     }
 }
Example #2
0
 /**
  * Creates a User object based on a DB row.
  *
  * @param array $row The DB row containing User data.
  * @return \MicroCMS\Domain\User
  */
 protected function buildDomainObject($row)
 {
     $user = new User();
     $user->setId($row['usr_id']);
     $user->setUsername($row['usr_name']);
     $user->setPassword($row['usr_password']);
     $user->setSalt($row['usr_salt']);
     $user->setRole($row['usr_role']);
     $user->setNom($row['usr_nom']);
     $user->setPrenom($row['usr_prenom']);
     $user->setIsadh($row['usr_isadh']);
     $user->setIdadh($row['usr_idadh']);
     return $user;
 }