public function createAction() { $this->haveAccess(1); $O_epi = new Epi(); $O_epi->setDealer($_POST['dealer']); $O_epi->setOrderNumber($_POST['order_number']); $O_date = new DateTime($_POST['manufacture_date']); $O_epi->setManufactureDate($O_date); $O_date = new DateTime($_POST['purchase_date']); $O_epi->setPurchaseDate($O_date); $O_epi->setProfile($_POST['profile']); $O_epi->setInternalReference($_POST['internal_reference']); $O_date = new DateTime("0000-00-00 00:00:00"); $O_epi->setCommissioningDate($O_date); $O_date = new DateTime(); $O_epi->setLastCheckDate($O_date); $O_date = new DateTime(); $S_date = $O_date->format('U') + 31536000; // je rajoute 1 ans $O_date = DateTime::createFromFormat('U', $S_date); $O_epi->setNextCheckDate($O_date); $O_date = new DateTime(); $S_date = $O_date->format('U') + 315360000; // je rajoute 10 ans $O_date = DateTime::createFromFormat('U', $S_date); $O_epi->setEndOfLifeDate($O_date); $O_user = $_SESSION['user']; $O_epi->setTeamId($O_user->getOperator()->getTeamId()); $O_epi->setLabelEpiId($_POST['label_epi_id']); $O_epiMapper = new EpiMapper(); $I_epiId = $O_epiMapper->insert($O_epi); die(header('Location:/epi/paginate/1')); }