Skip to content
This repository has been archived by the owner on Jan 6, 2020. It is now read-only.

Commit

Permalink
bug #516 Fixed crud generator regression after #511 (HeahDude)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.0.x-dev branch.

Discussion
----------

Fixed crud generator regression after #511

Closes #515.

Commits
-------

1f0b9f8 Fixed crud generator regression after #511
  • Loading branch information
fabpot committed Oct 10, 2016
2 parents badc502 + 1f0b9f8 commit b9be7f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Resources/skeleton/crud/actions/new.php.twig
Expand Up @@ -16,15 +16,15 @@
{% endblock method_definition %}
{
{% block method_body %}
${{ entity_singularized }} = new {{ entity_singularized|capitalize }}();
{% if use_form_type_instance -%}
$form = $this->createForm(new {{ entity_singularized|capitalize }}Type());
$form = $this->createForm(new {{ entity_singularized|capitalize }}Type(), ${{ entity_singularized }});
{% else -%}
$form = $this->createForm('{{ namespace }}\Form\{{ entity }}Type');
$form = $this->createForm('{{ namespace }}\Form\{{ entity }}Type', ${{ entity_singularized }});
{% endif -%}
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
${{ entity_singularized }} = $form->getData();
$em = $this->getDoctrine()->getManager();
$em->persist(${{ entity_singularized }});
$em->flush(${{ entity_singularized }});
Expand Down
4 changes: 2 additions & 2 deletions Tests/Generator/DoctrineCrudGeneratorTest.php
Expand Up @@ -213,10 +213,10 @@ public function testGenerateNamespacedEntity()
);
if (method_exists('Symfony\Compoennt\Form\AbstractType', 'getBlockPrefix')) {
// Symfony >= 2.8
$strings[] = '$form = $this->createForm(\'Foo\BarBundle\Form\Blog\PostType\');';
$strings[] = '$form = $this->createForm(\'Foo\BarBundle\Form\Blog\PostType\', $post);';
$strings[] = '$editForm = $this->createForm(\'Foo\BarBundle\Form\Blog\PostType\', $post);';
} else {
$strings[] = '$form = $this->createForm(new PostType());';
$strings[] = '$form = $this->createForm(new PostType(), $post);';
$strings[] = '$editForm = $this->createForm(new PostType(), $post);';
}
foreach ($strings as $string) {
Expand Down

0 comments on commit b9be7f1

Please sign in to comment.