|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace GGGGino\SkuskuCartBundle\Command; |
|
4
|
|
|
|
|
5
|
|
|
use GGGGino\SkuskuCartBundle\Service\CartManager; |
|
6
|
|
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
|
7
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
8
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Class CartClearCommand |
|
12
|
|
|
* @package GGGGino\SkuskuCartBundle\Command |
|
13
|
|
|
*/ |
|
14
|
|
|
class CartClearCommand extends ContainerAwareCommand |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* {@inheritdoc} |
|
18
|
|
|
*/ |
|
19
|
|
|
public function configure() |
|
20
|
|
|
{ |
|
21
|
|
|
$this |
|
22
|
|
|
->setName('ggggino_skusku:cart:clear') |
|
23
|
|
|
->setDescription('Empty the entities of the bundle') |
|
24
|
|
|
/*->addArgument('model', InputArgument::REQUIRED, 'The fully qualified model class') |
|
25
|
|
|
->addOption('bundle', 'b', InputOption::VALUE_OPTIONAL, 'The bundle name') |
|
26
|
|
|
->addOption('admin', 'a', InputOption::VALUE_OPTIONAL, 'The admin class basename') |
|
27
|
|
|
->addOption('controller', 'c', InputOption::VALUE_OPTIONAL, 'The controller class basename') |
|
28
|
|
|
->addOption('manager', 'm', InputOption::VALUE_OPTIONAL, 'The model manager type') |
|
29
|
|
|
->addOption('services', 'y', InputOption::VALUE_OPTIONAL, 'The services YAML file', 'services.yml') |
|
30
|
|
|
->addOption('id', 'i', InputOption::VALUE_OPTIONAL, 'The admin service ID')*/ |
|
31
|
|
|
; |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* {@inheritdoc} |
|
36
|
|
|
*/ |
|
37
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
|
38
|
|
|
{ |
|
39
|
|
|
/** @var CartManager $cartManager */ |
|
40
|
|
|
$cartManager = $this->getContainer()->get(CartManager::class); |
|
41
|
|
|
$cartManager->clearCart(); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* {@inheritdoc} |
|
46
|
|
|
*/ |
|
47
|
|
|
protected function interact(InputInterface $input, OutputInterface $output) |
|
48
|
|
|
{ |
|
49
|
|
|
} |
|
50
|
|
|
} |