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); } }