Skip to content

Commit 72b61d2

Browse files
ilario-pierbattistadavidwdan
authored andcommitted
Fixed post and put templates for Symfony3 compatibility
* Fixed post and put templates for Symfony3 compatibility * post and put templated fixed for symfony3 and php<5.5 compatibility
1 parent d82105f commit 72b61d2

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/Voryx/RESTGeneratorBundle/Resources/skeleton/rest/actions/post.php.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
{
2020
{% block method_body %}
2121
$entity = new {{ entity }}();
22-
$form = $this->createForm(new {{ entity }}Type(), $entity, array("method" => $request->getMethod()));
22+
$form = $this->createForm(get_class(new {{ entity }}Type()), $entity, array("method" => $request->getMethod()));
2323
$this->removeExtraFields($request, $form);
2424
$form->handleRequest($request);
2525

src/Voryx/RESTGeneratorBundle/Resources/skeleton/rest/actions/put.php.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
try {
2222
$em = $this->getDoctrine()->getManager();
2323
$request->setMethod('PATCH'); //Treat all PUTs as PATCH
24-
$form = $this->createForm(new {{ entity }}Type(), $entity, array("method" => $request->getMethod()));
24+
$form = $this->createForm(get_class(new {{ entity }}Type()), $entity, array("method" => $request->getMethod()));
2525
$this->removeExtraFields($request, $form);
2626
$form->handleRequest($request);
2727
if ($form->isValid()) {

0 commit comments

Comments
 (0)