Skip to content

Commit

Permalink
Merge pull request #178 from cnizzardini/bug/bake-theme
Browse files Browse the repository at this point in the history
Bug/bake theme
  • Loading branch information
cnizzardini authored Aug 22, 2020
2 parents b7c7642 + 7ec2f13 commit 77767ee
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Lib/Annotation/AbstractParameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function __construct(array $values)
throw new InvalidArgumentException('`name` or `ref` parameter is required');
}

$name = $values['name'];
$name = $values['name'] ?? $values['ref'];

if (isset($values['type']) && !in_array($values['type'], OpenApiDataType::TYPES)) {
$type = $values['type'];
Expand Down
1 change: 1 addition & 0 deletions templates/bake/element/Controller/add.twig
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
${{ singularName }} = $this->{{ currentModelName }}->newEmptyEntity();
${{ singularName }} = $this->{{ currentModelName }}->patchEntity(${{ singularName }}, $this->request->getData());
if ($this->{{ currentModelName }}->save(${{ singularName }})) {
$this->set('{{ singularName }}', ${{ singularName }});
$this->viewBuilder()->setOption('serialize', {{ compact|join(', ')|raw }});
return;
}
Expand Down
1 change: 1 addition & 0 deletions templates/bake/element/Controller/edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
]);
${{ singularName }} = $this->{{ currentModelName }}->patchEntity(${{ singularName }}, $this->request->getData());
if ($this->{{ currentModelName }}->save(${{ singularName }})) {
$this->set('{{ singularName }}', ${{ singularName }});
$this->viewBuilder()->setOption('serialize', {{ compact|join(', ')|raw }});
return;
}
Expand Down
2 changes: 2 additions & 0 deletions tests/assets/BakersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function add()
$baker = $this->Bakers->newEmptyEntity();
$baker = $this->Bakers->patchEntity($baker, $this->request->getData());
if ($this->Bakers->save($baker)) {
$this->set('baker', $baker);
$this->viewBuilder()->setOption('serialize', 'baker');
return;
}
Expand All @@ -84,6 +85,7 @@ public function edit($id = null)
]);
$baker = $this->Bakers->patchEntity($baker, $this->request->getData());
if ($this->Bakers->save($baker)) {
$this->set('baker', $baker);
$this->viewBuilder()->setOption('serialize', 'baker');
return;
}
Expand Down

0 comments on commit 77767ee

Please sign in to comment.