Skip to content

Commit b7007f1

Browse files
committed
minor #100 Update Form example (pierrejoye, weaverryan)
This PR was merged into the main branch. Discussion ---------- Update Form example Without specifying the action, Turbo redirect the full page to /. name="product_new" is not necessary in this specific example, it however may help newcomer to understand they can have separate route for this action (even if not recommended by the Symfony Form docs). Not sure if it is a bug in turbo or me doing wrong, adding this fixes it. | Q | A | ------------- | --- | Bug fix? | yes/no | New feature? | yes/no <!-- please update src/**/CHANGELOG.md files --> | Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT <!-- Replace this notice by a short README for your feature/bugfix. This will help people understand your PR and can be used as a start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Never break backward compatibility (see https://symfony.com/bc). - Features and deprecations must be submitted against branch main. --> Commits ------- 3248ee0 Removing warning not needed anymore and minor cs a3ff4ac Update Form example
2 parents 0edc432 + 3248ee0 commit b7007f1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Turbo/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,14 @@ automatically:
9797

9898
```php
9999
/**
100-
* @Route("/product/new")
100+
* @Route("/product/new", name="product_new")
101101
*/
102102
public function newProduct(Request $request): Response
103103
{
104104
return $this->handleForm(
105-
$this->createForm(ProductFormType::class),
105+
$this->createForm(ProductFormType::class, null, [
106+
'action' => $this->generateUrl('product_new'),
107+
]),
106108
$request,
107109
function (FormInterface $form) {
108110
// save...

0 commit comments

Comments
 (0)