Esempio n. 1
0
 public function insert(Epi $O_epi)
 {
     if (!is_null($O_epi->getDealer() && $O_epi->getOrderNumber() && $O_epi->getManufactureDate() && $O_epi->getPurchaseDate() && $O_epi->getProfile() && $O_epi->getInternalReference() && $O_epi->getCommissioningDate() && $O_epi->getLastCheckDate() && $O_epi->getNextCheckDate() && $O_epi->getEndOfLifeDate() && $O_epi->getLabelEpiId())) {
         // var_dump($O_epi);
         $S_dealer = $O_epi->getDealer();
         $S_order_number = $O_epi->getOrderNumber();
         $D_manufacture_date = $O_epi->getManufactureDate()->format('Y-m-d H:i:s');
         $D_purchase_date = $O_epi->getPurchaseDate()->format('Y-m-d H:i:s');
         $S_profile = $O_epi->getProfile();
         $S_internal_reference = $O_epi->getInternalReference();
         $D_commissioning_date = $O_epi->getCommissioningDate()->format('Y-m-d H:i:s');
         $D_last_check_date = $O_epi->getLastCheckDate()->format('Y-m-d H:i:s');
         $D_next_chack_date = $O_epi->getNextCheckDate()->format('Y-m-d H:i:s');
         $D_end_of_life_date = $O_epi->getEndOfLifeDate()->format('Y-m-d H:i:s');
         $I_label_epi_id = $O_epi->getLabelEpiId();
         $I_team_id = $O_epi->getTeamId();
         $S_sql = 'INSERT INTO `epi` (`dealer`, `order_number`, `manufacture_date`, `purchase_date`, `profile`, `internal_reference`, `commissioning_date`, `last_check_date`, `next_check_date`, `end_of_life_date`, `label_epi_id`, `team_id`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
         $A_params = array($S_dealer, $S_order_number, $D_manufacture_date, $D_purchase_date, $S_profile, $S_internal_reference, $D_commissioning_date, $D_last_check_date, $D_next_chack_date, $D_end_of_life_date, $I_label_epi_id, $I_team_id);
         $O_connection = new Connection();
         if ($I_epiId = $O_connection->requestDb($S_sql, $A_params)) {
             return $I_epiId;
         } else {
             throw new Exception("Des informations obligatoires sont manquantes, nous ne pouvons pas créer le modèle");
         }
     }
 }