public function insert(Inspector $O_inspector) { if (!is_null($O_inspector->getName() && $O_inspector->getFirstName() && $O_inspector->getEmail() && $O_inspector->getInceptionDate() && $O_inspector->getSubgroupId())) { $S_name = $O_inspector->getName(); $S_firstName = $O_inspector->getFirstName(); $S_email = $O_inspector->getEmail(); $O_inceptionDate = $O_inspector->getInceptionDate(); $I_subgroup_id = $O_inspector->getSubgroupId(); $S_sql = 'INSERT INTO inspector (name, first_name, email, inception_date, subgroup_id) VALUES (?, ?, ?, ?, ?)'; $A_params = array($S_name, $S_firstName, $S_email, $O_inceptionDate, $I_subgroup_id); $O_connection = new Connection(); if ($I_inspectorId = $O_connection->requestDb($S_sql, $A_params)) { return $I_inspectorId; } else { throw new Exception("Des informations obligatoires sont manquantes, nous ne pouvons pas créer l'utilisateur"); } } }