mailer = $mailer; $this->invoiceRepo = $invoiceRepo; $this->accountRepo = $accountRepo; } public function fire() { $this->info(date('Y-m-d').' Running SendReminders...'); $today = new DateTime(); $accounts = $this->accountRepo->findWithReminders(); $this->info(count($accounts).' accounts found'); foreach ($accounts as $account) { if (!$account->hasFeature(FEATURE_EMAIL_TEMPLATES_REMINDERS)) { continue; } $invoices = $this->invoiceRepo->findNeedingReminding($account); $this->info($account->name . ': ' . count($invoices).' invoices found'); foreach ($invoices as $invoice) { if ($reminder = $account->getInvoiceReminder($invoice)) { $this->info('Send to ' . $invoice->id); $this->mailer->sendInvoice($invoice, $reminder); } } } $this->info('Done'); } protected function getArguments() { return array( //array('example', InputArgument::REQUIRED, 'An example argument.'), ); } protected function getOptions() { return array( //array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null), ); } }