/** * Saves a rapportVisite into the database. * * @param \GSB\Domain\RapportVisite $rapportVisite The rapportVisite to save */ public function save(RapportVisite $rapportVisite) { $rapportVisiteData = array('id_praticien' => $rapportVisite->getPraticien()->getId(), 'id_visiteur' => $rapportVisite->getVisiteur()->getId(), 'date_rapport' => $rapportVisite->getDateRapport()->format('Y-m-d'), 'bilan' => $rapportVisite->getBilan(), 'motif' => $rapportVisite->getMotif()); // The rapportVisite has never been saved : insert it $this->getDb()->insert('rapport_visite', $rapportVisiteData); // Get the id of the newly created rapportVisite and set it on the entity. $id = $this->getDb()->lastInsertId(); $rapportVisite->setId($id); }