From 46ed35b7aceeea6e244b35d88882cfd87ccdcd62 Mon Sep 17 00:00:00 2001 From: Maxime Doutreluingne Date: Sun, 18 Feb 2024 11:05:29 +0100 Subject: [PATCH 1/5] [make:crud] Removal of the `createView()` method, as it is no longer required to render the form --- .../skeleton/registration/RegistrationController.tpl.php | 2 +- .../skeleton/resetPassword/ResetPasswordController.tpl.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Resources/skeleton/registration/RegistrationController.tpl.php b/src/Resources/skeleton/registration/RegistrationController.tpl.php index 3d45a8cb6..d4a013515 100644 --- a/src/Resources/skeleton/registration/RegistrationController.tpl.php +++ b/src/Resources/skeleton/registration/RegistrationController.tpl.php @@ -58,7 +58,7 @@ public function register(Request $request, g } return $this->render('registration/register.html.twig', [ - 'registrationForm' => $form->createView(), + 'registrationForm' => $form, ]); } diff --git a/src/Resources/skeleton/resetPassword/ResetPasswordController.tpl.php b/src/Resources/skeleton/resetPassword/ResetPasswordController.tpl.php index 1eefcdb12..c4127e554 100644 --- a/src/Resources/skeleton/resetPassword/ResetPasswordController.tpl.php +++ b/src/Resources/skeleton/resetPassword/ResetPasswordController.tpl.php @@ -33,7 +33,7 @@ public function request(Request $request, MailerInterface $mailerrender('reset_password/request.html.twig', [ - 'requestForm' => $form->createView(), + 'requestForm' => $form, ]); } @@ -109,7 +109,7 @@ public function reset(Request $request, UserPasswordHasherInterface $passwordHas } return $this->render('reset_password/reset.html.twig', [ - 'resetForm' => $form->createView(), + 'resetForm' => $form, ]); } From 81fdf8ee97a944486d421bcd5a02861f07953ab2 Mon Sep 17 00:00:00 2001 From: Maxime Doutreluingne Date: Sun, 18 Feb 2024 11:37:15 +0100 Subject: [PATCH 2/5] Change status code if form is invalid --- .../it_generates_registration_with_entity_and_authenticator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fixtures/make-registration-form/tests/it_generates_registration_with_entity_and_authenticator.php b/tests/fixtures/make-registration-form/tests/it_generates_registration_with_entity_and_authenticator.php index f87e1aaf5..1e23dd893 100644 --- a/tests/fixtures/make-registration-form/tests/it_generates_registration_with_entity_and_authenticator.php +++ b/tests/fixtures/make-registration-form/tests/it_generates_registration_with_entity_and_authenticator.php @@ -54,7 +54,7 @@ public function testRegistrationValidationError() $form['registration_form[plainPassword]'] = 'foo'; $client->submit($form); - $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(422, $client->getResponse()->getStatusCode()); $this->assertStringContainsString( 'There is already an account with this email', $client->getResponse()->getContent() From b70e00fee4aa2a78f5d5634ae645b83d73040703 Mon Sep 17 00:00:00 2001 From: Maxime Doutreluingne Date: Sun, 18 Feb 2024 11:37:15 +0100 Subject: [PATCH 3/5] Change status code if form is not invalid --- .../it_generates_registration_with_entity_and_authenticator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fixtures/make-registration-form/tests/it_generates_registration_with_entity_and_authenticator.php b/tests/fixtures/make-registration-form/tests/it_generates_registration_with_entity_and_authenticator.php index f87e1aaf5..1e23dd893 100644 --- a/tests/fixtures/make-registration-form/tests/it_generates_registration_with_entity_and_authenticator.php +++ b/tests/fixtures/make-registration-form/tests/it_generates_registration_with_entity_and_authenticator.php @@ -54,7 +54,7 @@ public function testRegistrationValidationError() $form['registration_form[plainPassword]'] = 'foo'; $client->submit($form); - $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(422, $client->getResponse()->getStatusCode()); $this->assertStringContainsString( 'There is already an account with this email', $client->getResponse()->getContent() From 8bfa60c16b8776f27e7289d0e5b8646551e01c7b Mon Sep 17 00:00:00 2001 From: Maxime Doutreluingne Date: Tue, 20 Feb 2024 18:17:41 +0100 Subject: [PATCH 4/5] With status code 200 --- .../it_generates_registration_with_entity_and_authenticator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fixtures/make-registration-form/tests/it_generates_registration_with_entity_and_authenticator.php b/tests/fixtures/make-registration-form/tests/it_generates_registration_with_entity_and_authenticator.php index 1e23dd893..f87e1aaf5 100644 --- a/tests/fixtures/make-registration-form/tests/it_generates_registration_with_entity_and_authenticator.php +++ b/tests/fixtures/make-registration-form/tests/it_generates_registration_with_entity_and_authenticator.php @@ -54,7 +54,7 @@ public function testRegistrationValidationError() $form['registration_form[plainPassword]'] = 'foo'; $client->submit($form); - $this->assertSame(422, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertStringContainsString( 'There is already an account with this email', $client->getResponse()->getContent() From 358781264ca59c02ce9d03f11cdae88620665b50 Mon Sep 17 00:00:00 2001 From: Maxime Doutreluingne Date: Tue, 20 Feb 2024 18:38:13 +0100 Subject: [PATCH 5/5] With status code 422 --- .../it_generates_registration_with_entity_and_authenticator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fixtures/make-registration-form/tests/it_generates_registration_with_entity_and_authenticator.php b/tests/fixtures/make-registration-form/tests/it_generates_registration_with_entity_and_authenticator.php index f87e1aaf5..1e23dd893 100644 --- a/tests/fixtures/make-registration-form/tests/it_generates_registration_with_entity_and_authenticator.php +++ b/tests/fixtures/make-registration-form/tests/it_generates_registration_with_entity_and_authenticator.php @@ -54,7 +54,7 @@ public function testRegistrationValidationError() $form['registration_form[plainPassword]'] = 'foo'; $client->submit($form); - $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(422, $client->getResponse()->getStatusCode()); $this->assertStringContainsString( 'There is already an account with this email', $client->getResponse()->getContent()