|
20 | 20 | use Symfony\Component\Form\Util\FormUtil;
|
21 | 21 | use Symfony\Component\Form\Util\InheritDataAwareIterator;
|
22 | 22 | use Symfony\Component\Form\Util\OrderedHashMap;
|
| 23 | +use Symfony\Component\HttpFoundation\Request; |
23 | 24 | use Symfony\Component\PropertyAccess\PropertyPath;
|
24 | 25 |
|
25 | 26 | /**
|
@@ -505,6 +506,10 @@ public function handleRequest($request = null)
|
505 | 506 | */
|
506 | 507 | public function submit($submittedData, $clearMissing = true)
|
507 | 508 | {
|
| 509 | + if ($submittedData instanceof Request) { |
| 510 | + trigger_error('Passing a Symfony\Component\HttpFoundation\Request object to '.__CLASS__.'::bind() and '.__METHOD__.'() is deprecated since 2.3 and will be removed in 3.0, please use '.__CLASS__.'::handleRequest(). If you want to test whether the form was submitted separately, you can use the method '.__CLASS__.'::isSubmitted()', E_USER_DEPRECATED); |
| 511 | + } |
| 512 | + |
508 | 513 | if ($this->submitted) {
|
509 | 514 | throw new AlreadySubmittedException('A form can only be submitted once');
|
510 | 515 | }
|
@@ -676,6 +681,12 @@ public function submit($submittedData, $clearMissing = true)
|
676 | 681 | */
|
677 | 682 | public function bind($submittedData)
|
678 | 683 | {
|
| 684 | + // This method is deprecated for Request too, but the error is |
| 685 | + // triggered in Form::submit() method. |
| 686 | + if (!$submittedData instanceof Request) { |
| 687 | + trigger_error(__METHOD__.'() is deprecated since 2.3 and will be removed in 3.0. Please use '.__CLASS__.'::submit() instead.', E_USER_DEPRECATED); |
| 688 | + } |
| 689 | + |
679 | 690 | return $this->submit($submittedData);
|
680 | 691 | }
|
681 | 692 |
|
@@ -713,6 +724,8 @@ public function isSubmitted()
|
713 | 724 | */
|
714 | 725 | public function isBound()
|
715 | 726 | {
|
| 727 | + trigger_error(__METHOD__.'() is deprecated since 2.3 and will be removed in 3.0. Please use '.__CLASS__.'::isSubmitted() instead.', E_USER_DEPRECATED); |
| 728 | + |
716 | 729 | return $this->submitted;
|
717 | 730 | }
|
718 | 731 |
|
|
0 commit comments