Fix when date is not speicifed in warranty:sms command #394
This commit is contained in:
parent
e8446cd181
commit
1a78320ca9
1 changed files with 6 additions and 4 deletions
|
|
@ -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]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue