findOne(); } catch (\Exception $ex) {*/ $database = new Database($con->getWrappedConnection()); $database->insertSql(null, array(__DIR__ . '/Config/thelia.sql')); // } } /** * Retourne la remise en fnction du nombre de jours achetés * * @param \DateTime $dateDebut * @param \DateTime $dateFin * @return float */ public static function getRemiseDuree(\DateTime $dateDebut, \DateTime $dateFin, &$nombreDeJours) { $nombreDeJours = round(($dateFin->getTimeStamp() - $dateDebut->getTimeStamp()) / 86400); if ($nombreDeJours >= 7) { return 0.09; } if ($nombreDeJours >= 6) { return 0.08; } if ($nombreDeJours >= 5) { return 0.07; } if ($nombreDeJours >= 4) { return 0.06; } if ($nombreDeJours >= 3) { return 0.05; } if ($nombreDeJours >= 2) { return 0.03; } return 0.0; } }