8000 [Form] allow additional http methods in form configuration by alekitto · Pull Request #26324 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] allow additional http methods in form configuration #26324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
<!-- FormFactory -->
<service id="form.factory" class="Symfony\Component\Form\FormFactory" public="true">
<argument type="service" id="form.registry" />
<argument type="service" id="form.resolved_type_factory" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for 3.4?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second constructor parameter was deleted in 3607eb3 (included in 3.3 beta 1).
Should I restore it?

Copy link
Member
@xabbuh xabbuh Sep 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @ro0NL meant that this change could probably be made on a lower version of the FrameworkBundle too (i.e. all versions that do not support the Form component in version 3.2 or lower).

</service>
<service id="Symfony\Component\Form\FormFactoryInterface" alias="form.factory" />

Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Form/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ CHANGELOG
* deprecated calling `FormRenderer::searchAndRenderBlock` for fields which were already rendered
* added a cause when a CSRF error has occurred
* deprecated the `scale` option of the `IntegerType`
* removed restriction on allowed HTTP methods

4.1.0
-----
Expand Down
21 changes: 1 addition & 20 deletions src/Symfony/Component/Form/FormConfigBuilder.php
9F1A
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
*/
private static $nativeRequestHandler;

/**
* The accepted request methods.
*
* @var array
*/
private static $allowedMethods = array(
'GET',
'PUT',
'POST',
'DELETE',
'PATCH',
);

/**
* @var bool
*/
Expand Down Expand Up @@ -788,13 +775,7 @@ public function setMethod($method)
throw new BadMethodCallException('The config builder cannot be modified anymore.');
}

$upperCaseMethod = strtoupper($method);

if (!\in_array($upperCaseMethod, self::$allowedMethods)) {
throw new InvalidArgumentException(sprintf('The form method is "%s", but should be one of "%s".', $method, implode('", "', self::$allowedMethods)));
}

$this->method = $upperCaseMethod;
$this->method = strtoupper($method);

return $this;
}
Expand Down
8 changes: 0 additions & 8 deletions src/Symfony/Component/Form/Tests/FormConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,6 @@ public function testSetMethodAllowsPatch()
self::assertSame('PATCH', $formConfigBuilder->getMethod());
}

/**
* @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
*/
public function testSetMethodDoesNotAllowOtherValues()
{
$this->getConfigBuilder()->setMethod('foo');
}

private function getConfigBuilder($name = 'name')
{
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
Expand Down
0