diff --git a/src/Command/WarrantySMSCommand.php b/src/Command/WarrantySMSCommand.php index 24ae7542..dfacab65 100644 --- a/src/Command/WarrantySMSCommand.php +++ b/src/Command/WarrantySMSCommand.php @@ -37,14 +37,16 @@ class WarrantySMSCommand extends Command protected function execute(InputInterface $input, OutputInterface $output) { - $date = new DateTime(); $date_string = $input->getArgument('date'); + // if date is specified if (!empty($date_string)) - { $date = DateTime::createFromFormat('Ymd', $date_string); - $date->modify('-1 month'); - } + else + $date = new DateTime(); + + // -1 month + $date->modify('-1 month'); $warrs = $this->em->getRepository(Warranty::class)->findBy(['date_expire' => $date]);