Skip to content

Commit 24653a2

Browse files
authored
Merge pull request #32 from dotkernel/issue-29
Issue #29: Fixed route name used in `Form` action attributes
2 parents 4fb3767 + a7ac0df commit 24653a2

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

src/Type/Handler/GetCreateResourceHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function render(Component $handler, Component $entity, Component $form):
8686
)
8787
->setBody(<<<BODY
8888
\$this->{$form->toCamelCase()}
89-
->setAttribute('action', \$this->router->generateUri('{$entity->toKebabCase()}::{$entity->toKebabCase()}-create'));
89+
->setAttribute('action', \$this->router->generateUri('{$entity->toKebabCase()}::create-{$entity->toKebabCase()}'));
9090
9191
return new HtmlResponse(
9292
\$this->template->render('{$entity->toKebabCase()}::create-{$entity->toKebabCase()}-form', [

src/Type/Handler/GetDeleteResourceHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function render(Component $handler, Component $entity, Component $form, C
112112
113113
\$this->{$form->toCamelCase()}->setAttribute(
114114
'action',
115-
\$this->router->generateUri('{$entity->toKebabCase()}::{$entity->toKebabCase()}-delete', ['uuid' => {$entity->getVariable()}->getUuid()->toString()])
115+
\$this->router->generateUri('{$entity->toKebabCase()}::delete-{$entity->toKebabCase()}', ['uuid' => {$entity->getVariable()}->getUuid()->toString()])
116116
);
117117
118118
return new HtmlResponse(

src/Type/Handler/GetEditResourceHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function render(Component $handler, Component $entity, Component $form, C
113113
\$this->{$form->toCamelCase()}
114114
->setAttribute(
115115
'action',
116-
\$this->router->generateUri('{$entity->toKebabCase()}::{$entity->toKebabCase()}-edit', ['uuid' => {$entity->getVariable()}->getUuid()->toString()])
116+
\$this->router->generateUri('{$entity->toKebabCase()}::edit-{$entity->toKebabCase()}', ['uuid' => {$entity->getVariable()}->getUuid()->toString()])
117117
)
118118
->bind({$entity->getVariable()});
119119

src/Type/Handler/PostCreateResourceHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function render(Component $handler, Component $entity, Component $form, C
110110
)
111111
->setBody(<<<BODY
112112
\$this->{$form->toCamelCase()}
113-
->setAttribute('action', \$this->router->generateUri('{$entity->toKebabCase()}::{$entity->toKebabCase()}-create'));
113+
->setAttribute('action', \$this->router->generateUri('{$entity->toKebabCase()}::create-{$entity->toKebabCase()}'));
114114
115115
try {
116116
\$data = (array) \$request->getParsedBody();

src/Type/Handler/PostDeleteResourceHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function render(Component $handler, Component $entity, Component $form, C
119119
120120
\$this->{$form->toCamelCase()}->setAttribute(
121121
'action',
122-
\$this->router->generateUri('{$entity->toKebabCase()}::{$entity->toKebabCase()}-delete', ['uuid' => {$entity->getVariable()}->getUuid()->toString()])
122+
\$this->router->generateUri('{$entity->toKebabCase()}::delete-{$entity->toKebabCase()}', ['uuid' => {$entity->getVariable()}->getUuid()->toString()])
123123
);
124124
125125
try {

src/Type/Handler/PostEditResourceHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function render(Component $handler, Component $entity, Component $form, C
122122
\$this->{$form->toCamelCase()}
123123
->setAttribute(
124124
'action',
125-
\$this->router->generateUri('{$entity->toKebabCase()}::{$entity->toKebabCase()}-edit', ['uuid' => {$entity->getVariable()}->getUuid()->toString()])
125+
\$this->router->generateUri('{$entity->toKebabCase()}::edit-{$entity->toKebabCase()}', ['uuid' => {$entity->getVariable()}->getUuid()->toString()])
126126
);
127127
128128
try {

test/Type/HandlerTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ public function handle(
12141214
ServerRequestInterface \$request,
12151215
): ResponseInterface {
12161216
\$this->createBookStoreForm
1217-
->setAttribute('action', \$this->router->generateUri('book-store::book-store-create'));
1217+
->setAttribute('action', \$this->router->generateUri('book-store::create-book-store'));
12181218
12191219
return new HtmlResponse(
12201220
\$this->template->render('book-store::create-book-store-form', [
@@ -1285,7 +1285,7 @@ public function handle(
12851285
ServerRequestInterface \$request,
12861286
): ResponseInterface {
12871287
\$this->createBookStoreForm
1288-
->setAttribute('action', \$this->router->generateUri('book-store::book-store-create'));
1288+
->setAttribute('action', \$this->router->generateUri('book-store::create-book-store'));
12891289
12901290
try {
12911291
\$data = (array) \$request->getParsedBody();
@@ -1400,7 +1400,7 @@ public function handle(
14001400
14011401
\$this->deleteBookStoreForm->setAttribute(
14021402
'action',
1403-
\$this->router->generateUri('book-store::book-store-delete', ['uuid' => \$bookStore->getUuid()->toString()])
1403+
\$this->router->generateUri('book-store::delete-book-store', ['uuid' => \$bookStore->getUuid()->toString()])
14041404
);
14051405
14061406
return new HtmlResponse(
@@ -1482,7 +1482,7 @@ public function handle(
14821482
14831483
\$this->deleteBookStoreForm->setAttribute(
14841484
'action',
1485-
\$this->router->generateUri('book-store::book-store-delete', ['uuid' => \$bookStore->getUuid()->toString()])
1485+
\$this->router->generateUri('book-store::delete-book-store', ['uuid' => \$bookStore->getUuid()->toString()])
14861486
);
14871487
14881488
try {
@@ -1583,7 +1583,7 @@ public function handle(
15831583
\$this->editBookStoreForm
15841584
->setAttribute(
15851585
'action',
1586-
\$this->router->generateUri('book-store::book-store-edit', ['uuid' => \$bookStore->getUuid()->toString()])
1586+
\$this->router->generateUri('book-store::edit-book-store', ['uuid' => \$bookStore->getUuid()->toString()])
15871587
)
15881588
->bind(\$bookStore);
15891589
@@ -1671,7 +1671,7 @@ public function handle(
16711671
\$this->editBookStoreForm
16721672
->setAttribute(
16731673
'action',
1674-
\$this->router->generateUri('book-store::book-store-edit', ['uuid' => \$bookStore->getUuid()->toString()])
1674+
\$this->router->generateUri('book-store::edit-book-store', ['uuid' => \$bookStore->getUuid()->toString()])
16751675
);
16761676
16771677
try {

0 commit comments

Comments
 (0)