1 | <?php |
||
22 | class GenerateResourceCommand extends GenerateDoctrineEntityCommand |
||
23 | { |
||
24 | /** |
||
25 | * @var ResourceGenerator |
||
26 | */ |
||
27 | private $resourceGenerator; |
||
28 | /** |
||
29 | * @var LoaderInterface |
||
30 | */ |
||
31 | private $definitionLoader; |
||
32 | /** |
||
33 | * @var InputInterface |
||
34 | */ |
||
35 | private $input; |
||
36 | |||
37 | /** |
||
38 | * @param ResourceGenerator $resourceGenerator generator to use for resource generation |
||
39 | * @param LoaderInterface $definitionLoader JSON definition loaded |
||
40 | */ |
||
41 | 4 | public function __construct(ResourceGenerator $resourceGenerator, LoaderInterface $definitionLoader) |
|
47 | |||
48 | /** |
||
49 | * {@inheritDoc} |
||
50 | * |
||
51 | * @return void |
||
52 | */ |
||
53 | 4 | protected function configure() |
|
54 | { |
||
55 | 4 | parent::configure(); |
|
56 | |||
57 | 4 | $this |
|
58 | 4 | ->addOption( |
|
59 | 4 | 'json', |
|
60 | 4 | '', |
|
61 | 4 | InputOption::VALUE_OPTIONAL, |
|
62 | 'Path to the json definition.' |
||
63 | 4 | ) |
|
64 | 4 | ->addOption( |
|
65 | 4 | 'no-controller', |
|
66 | 4 | '', |
|
67 | 4 | InputOption::VALUE_OPTIONAL, |
|
68 | 'Pass if no controller should be generated' |
||
69 | 4 | ) |
|
70 | 4 | ->setName('graviton:generate:resource') |
|
71 | 4 | ->setDescription('Generates a graviton rest resource'); |
|
72 | 4 | } |
|
73 | |||
74 | /** |
||
75 | * {@inheritDoc} |
||
76 | * |
||
77 | * @param InputInterface $input input |
||
78 | * @param OutputInterface $output output |
||
79 | * |
||
80 | * @return void |
||
81 | */ |
||
82 | protected function execute(InputInterface $input, OutputInterface $output) |
||
83 | { |
||
84 | // put input here for later use.. |
||
85 | $this->input = $input; |
||
86 | |||
87 | parent::execute( |
||
88 | $input, |
||
89 | $output |
||
90 | ); |
||
91 | } |
||
92 | |||
93 | /** |
||
94 | * {@inheritDoc} |
||
95 | * |
||
96 | * @return ResourceGenerator |
||
97 | */ |
||
98 | protected function createGenerator() |
||
114 | } |
||
115 |