Skip to content

Commit 9deced8

Browse files
authored
Merge pull request #4 from efiorello/master
Fix command generator
2 parents 4f24a44 + 73e4170 commit 9deced8

File tree

6 files changed

+12
-10
lines changed

6 files changed

+12
-10
lines changed

Lube/GeneratorBundle/Command/GenerateAPICommand.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,14 @@ protected function interact(InputInterface $input, OutputInterface $output)
126126
}
127127
else
128128
{
129-
$question = new ConfirmationQuestion('Do you wish your cGet action to have filters and order? <info>[yes]</info> ', true);
129+
$question = new ConfirmationQuestion('Do you wish your cGet action to be simpler (no filters or order)? <info>[yes]</info> ', true);
130130

131131
$input->setOption('with-simple-cget', $helper->ask($input, $output, $question));
132132
}
133133

134+
$summary[] = sprintf("Actions: %s", ($input->getOption('with-simple-cget') ? 'cGetSimple, Get' : 'cGet, Get'));
135+
$summary[] = '';
136+
134137
if ($input->hasArgument('with-update'))
135138
{
136139
$input->setOption('with-update', $input->getArgument('with-update'));
@@ -142,7 +145,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
142145
$input->setOption('with-update', $helper->ask($input, $output, $question));
143146
}
144147

145-
$summary[] = sprintf("Actions: %s", ($input->getOption('with-update') ? 'cGet, Get, Save, Remove, Update' : 'cGet, Get'));
148+
$summary[] = sprintf("Actions: %s", ($input->getOption('with-update') ? 'Save, Remove, Update' : ''));
146149
$summary[] = '';
147150

148151
//Rol
@@ -217,6 +220,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
217220
$Entity['Rol'] = $input->getOption('role');
218221
$Entity['Name'] = $EntityName;
219222
$Entity['Metadata'] = $EntityMetadata;
223+
$Entity['Actions'] = [];
220224

221225
if ($input->getOption('with-update')) {
222226
array_push($Entity['Actions'], 'save', 'remove', 'update');
@@ -227,9 +231,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
227231
} else {
228232
array_push($Entity['Actions'], 'cget');
229233
}
230-
234+
231235
array_push($Entity['Actions'], 'get');
232-
233236

234237
$this->renderFile('controller.php.twig',
235238
$BundlePath . '/Controller/' . $EntityName . 'Controller.php',

Lube/GeneratorBundle/Resources/templates/actions/cget.php.twig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
* parameters={
1010
* {"name"="filter_by", "dataType"="json", "required"=false, "description"="Filtros para listar {{ Entity['Name'] }}s"},
1111
* {"name"="order_by", "dataType"="json", "required"=false, "description"="Filtros para ordenar {{ Entity['Name'] }}s"},
12-
* parameters={
1312
* {"name"="offset", "dataType"="integer", "required"=false, "description"="Offset para paginacion"},
14-
* {"name"="limit", "dataType"="integer", "required"=false, "description"="Limit para paginacion"},
13+
* {"name"="limit", "dataType"="integer", "required"=false, "description"="Limit para paginacion"}
1514
* },
1615
* tags={
1716
* "a revisar: Dev" = "#5bc0de"

Lube/GeneratorBundle/Resources/templates/actions/cget_simple.php.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* resource=true,
99
* parameters={
1010
* {"name"="offset", "dataType"="integer", "required"=false, "description"="Offset para paginacion"},
11-
* {"name"="limit", "dataType"="integer", "required"=false, "description"="Limit para paginacion"},
11+
* {"name"="limit", "dataType"="integer", "required"=false, "description"="Limit para paginacion"}
1212
* },
1313
* tags={
1414
* "a revisar: Dev" = "#5bc0de"

Lube/GeneratorBundle/Resources/templates/actions/remove.php.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @Method({"DELETE"})
66
* @ParamConverter("{{ Entity['Name'] | lower }}", class="{{ Bundle['Name'] }}:{{ Entity['Name'] }}")
77
* @ApiDoc(
8-
* description="Remueve un {{ Entity['Name'] }}"
8+
* description="Remueve un {{ Entity['Name'] }}",
99
* section="{{ Entity['Name'] }}",
1010
* resource=true,
1111
* tags={

Lube/GeneratorBundle/Resources/templates/actions/save.php.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @Route(" ")
55
* @Method({"POST"})
66
* @ApiDoc(
7-
* description="Crea un {{ Entity['Name'] }}"
7+
* description="Crea un {{ Entity['Name'] }}",
88
* section="{{ Entity['Name'] }}",
99
* resource=true,
1010
* tags={

Lube/GeneratorBundle/Resources/templates/actions/update.php.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @Method({"POST"})
66
* @ParamConverter("{{ Entity['Name'] | lower }}", class="{{ Bundle['Name'] }}:{{ Entity['Name'] }}")
77
* @ApiDoc(
8-
* description="Actualiza un {{ Entity['Name'] }}"
8+
* description="Actualiza un {{ Entity['Name'] }}",
99
* section="{{ Entity['Name'] }}",
1010
* resource=true,
1111
* tags={

0 commit comments

Comments
 (0)