/** * Retourne la formation associé * @return type FormationsModel */ public function getFormation() { return FormationsModel::findById($this->id_formation); }
public function test_formFindById() { $db = DB::Connect(); $result = $db->query("SELECT libelle_formation as nom FROM FORMATIONS WHERE id_formation = 2"); $result->setFetchMode(PDO::FETCH_OBJ); $result = $result->fetch(); $attendu = $result->nom; $formation = FormationsModel::findById(2); if ($formation) { $this->message["form_findById_mess"] = "Attendu : " . $attendu . " - Trouver : " . $formation->getName(); } else { $this->message["form_findById_mess"] = "Attendu : " . $attendu . " - Trouver : Rien"; } return !empty($formation) && $formation->getName() === $attendu; }