| 1 | <?php |
||
| 2 | |||
| 3 | namespace Terox\SubscriptionBundle\Command; |
||
| 4 | |||
| 5 | use Symfony\Component\Console\Input\InputArgument; |
||
| 6 | use Terox\SubscriptionBundle\Model\SubscriptionInterface; |
||
| 7 | use Terox\SubscriptionBundle\TeroxSubscriptionBundle; |
||
| 8 | |||
| 9 | class ExpireCommand extends AbstractCommand |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * {@inheritdoc} |
||
| 13 | */ |
||
| 14 | 1 | protected function configure() |
|
| 15 | { |
||
| 16 | 1 | parent::configure(); |
|
| 17 | |||
| 18 | $this |
||
| 19 | 1 | ->setName(TeroxSubscriptionBundle::COMMAND_NAMESPACE.':expire') |
|
| 20 | 1 | ->setDescription('Expire a subscription') |
|
| 21 | 1 | ->addArgument( |
|
| 22 | 1 | 'reason', |
|
| 23 | 1 | InputArgument::OPTIONAL, |
|
| 24 | 1 | 'Reason of expiration', |
|
| 25 | 1 | 'expired' |
|
| 26 | ); |
||
| 27 | 1 | } |
|
| 28 | |||
| 29 | /** |
||
| 30 | * {@inheritdoc} |
||
| 31 | */ |
||
| 32 | 1 | protected function action(SubscriptionInterface $subscription) |
|
| 33 | { |
||
| 34 | 1 | $reason = $this->input->getArgument('reason'); |
|
| 35 | |||
| 36 | 1 | $this->getManager()->expire($subscription, $reason); |
|
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 37 | |||
| 38 | 1 | $this->output->writeln(sprintf('Expired subscription')); |
|
| 39 | 1 | } |
|
| 40 | } |
||
| 41 |