-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[3.0] Clean Form, Validator, DowCrawler and some more #16075
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
Conversation
nicolas-grekas
commented
Oct 2, 2015
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | - |
License | MIT |
Doc PR | - |
fa56ecd
to
da438fa
Compare
@@ -61,36 +61,12 @@ public function createForProperty($class, $property, $data = null, array $option | |||
*/ | |||
public function createBuilder($type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = array()) | |||
{ | |||
$name = null; | |||
$typeName = null; | |||
|
|||
if ($type instanceof ResolvedFormTypeInterface) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getBlockPrefix must be added to ResolvedFormTypeInterface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we actually need to keep support for ResolvedFormTypeInterface
in the factory. it is not supported according to FormFactoryInterface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is a bug in the current implementation. createBuilder has logic to handle ResolvedFormTypeInterface, but it then calls createNamedBuilder which will throw an exception as it requires a string as the type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it must be removed. It was deprecated in 2.8: https://github.com/symfony/symfony/blob/2.8/src/Symfony/Component/Form/FormFactory.php#L114
So it must be removed from this method as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/FormFactoryInterface.php must be updated as well as it still says string|FormTypeInterface $type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, can you please review again?
f2d71b8
to
9d47437
Compare
* @param string|FormTypeInterface $type The type of the form | ||
* @param mixed $data The initial data | ||
* @param array $options The options | ||
* @param string $type The type of the form |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are more of it in the interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
9d47437
to
f1fecb4
Compare
/** | ||
* @param ValidatorInterface $validator | ||
* @param ViolationMapperInterface $violationMapper | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I know what is the reason of removing the docblock comments ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they provide no value at all, this is just an exact repetition of the method signature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, thanks. I wonder whether this have any impact on the sami / phpdoc .
Please also remove max_length from https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/FormFactoryInterface.php#L96 |
f1fecb4
to
14e6761
Compare
Removed |
The |
14e6761
to
f3478f9
Compare
@Tobion I agree with you, but this is more tricky and could be left for an other PR. |
The |
@@ -846,136 +846,6 @@ public static function xpathLiteral($s) | |||
} | |||
|
|||
/** | |||
* @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. | |||
*/ | |||
public function attach($object, $data = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing this without actually removing extends \SplObjectStorage
makes no sense
Apart from the changes in |
f3478f9
to
4ea2af5
Compare
Crawler updated |
4ea2af5
to
abca2d6
Compare
@@ -38,12 +38,6 @@ class ExceptionHandler | |||
|
|||
public function __construct($debug = true, $charset = null, $fileLinkFormat = null) | |||
{ | |||
if (false !== strpos($charset, '%')) { | |||
// Swap $charset and $fileLinkFormat for BC reasons |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #16085
Thank you @nicolas-grekas. |
…(nicolas-grekas) This PR was merged into the 3.0-dev branch. Discussion ---------- [3.0] Clean Form, Validator, DowCrawler and some more | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- abca2d6 [3.0] Clean Form, Validator, DowCrawler and some more
This PR was merged into the 2.8 branch. Discussion ---------- Add a few additional tests for the Crawler | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a While looking at the update of the Crawler in #16075, I spotted a few mistakes. But these were cases not covered by the testsuite. This is adding tests for these cases in the 2.8 branch (they could be added in 2.3 eventually though). Commits ------- 528d3bd Add a few additional tests for the Crawler
This PR was merged into the 3.0-dev branch. Discussion ---------- Fix the crawler refactoring | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a This fixes a few mistakes I spotted in #16075 for the DomCrawler component. Regression tests are added separately in #16093 to be included in older branches too. Commits ------- d128735 Fix the crawler refactoring
Hello @nicolas-grekas How can I create forms which comes from a service for instance? |
@renatomefidf defining form types as service never required passing the instance to createForm. If you are passing an instance here, it means you are not using your form type as a service as far as the Form component is concerned. |
Thank you @stof Thanks again for helping and making it clearer! |
OK, I answered on SO itself |
@stof I am trying to do the same as @renatomefidf But I can't get it to work. Should I be using the form name defined in the form class within getBlockPrefix(), or the forms service name or the name defined in the service definition within I have tried with
The last one uses the form class but not the form as a service, which is what I need. Thanks |
@PaddyLock The tag name to add a form type service is |