|
102 | 102 | ```
|
103 | 103 | * The custom factories for the firewall configuration are now
|
104 | 104 | registered during the build method of bundles instead of being registered
|
105 |
| - by the end-user. This means that you will you need to remove the 'factories' |
| 105 | + by the end-user. This means that you will you need to remove the 'factories' |
106 | 106 | keys in your security configuration.
|
107 | 107 |
|
108 | 108 | * The Firewall listener is now registered after the Router listener. This
|
|
313 | 313 | return isset($options['widget']) && 'single_text' === $options['widget'] ? 'text' : 'choice';
|
314 | 314 | }
|
315 | 315 | ```
|
316 |
| - |
| 316 | +
|
317 | 317 | * The methods `getDefaultOptions()` and `getAllowedOptionValues()` of form
|
318 | 318 | types no longer receive an option array.
|
319 |
| - |
| 319 | +
|
320 | 320 | You can specify options that depend on other options using closures instead.
|
321 |
| - |
| 321 | +
|
322 | 322 | Before:
|
323 |
| - |
| 323 | +
|
324 | 324 | ```
|
325 | 325 | public function getDefaultOptions(array $options)
|
326 | 326 | {
|
327 | 327 | $defaultOptions = array();
|
328 |
| - |
| 328 | +
|
329 | 329 | if ($options['multiple']) {
|
330 | 330 | $defaultOptions['empty_data'] = array();
|
331 | 331 | }
|
332 |
| - |
| 332 | +
|
333 | 333 | return $defaultOptions;
|
334 | 334 | }
|
335 | 335 | ```
|
336 |
| - |
| 336 | +
|
337 | 337 | After:
|
338 |
| - |
| 338 | +
|
339 | 339 | ```
|
340 | 340 | public function getDefaultOptions()
|
341 | 341 | {
|
|
346 | 346 | );
|
347 | 347 | }
|
348 | 348 | ```
|
349 |
| - |
| 349 | +
|
350 | 350 | The second argument `$previousValue` does not have to be specified if not
|
351 | 351 | needed.
|
352 | 352 |
|
|
366 | 366 | (or any other of the BIND events). In case you used the CallbackValidator
|
367 | 367 | class, you should now pass the callback directly to `addEventListener`.
|
368 | 368 |
|
369 |
| - * simplified CSRF protection and removed the csrf type |
| 369 | + * Since FormType and FieldType were merged, you need to adapt your form |
| 370 | + themes. |
| 371 | +
|
| 372 | + The "field_widget" and all references to it should be renamed to |
| 373 | + "form_widget_primitive": |
| 374 | +
|
| 375 | + Before: |
| 376 | +
|
| 377 | + ``` |
| 378 | + {% block url_widget %} |
| 379 | + {% spaceless %} |
| 380 | + {% set type = type|default('url') %} |
| 381 | + {{ block('field_widget') }} |
| 382 | + {% endspaceless %} |
| 383 | + {% endblock url_widget %} |
| 384 | + ``` |
| 385 | +
|
| 386 | + After: |
| 387 | +
|
| 388 | + ``` |
| 389 | + {% block url_widget %} |
| 390 | + {% spaceless %} |
| 391 | + {% set type = type|default('url') %} |
| 392 | + {{ block('form_widget_primitive') }} |
| 393 | + {% endspaceless %} |
| 394 | + {% endblock url_widget %} |
| 395 | + ``` |
| 396 | +
|
| 397 | + All other "field_*" blocks and references to them should be renamed to |
| 398 | + "form_*". If you previously defined both a "field_*" and a "form_*" |
| 399 | + block, you can merge them into a single "form_*" block and check the new |
| 400 | + Boolean variable "primitive": |
| 401 | +
|
| 402 | + Before: |
| 403 | +
|
| 404 | + ``` |
| 405 | + {% block form_errors %} |
| 406 | + {% spaceless %} |
| 407 | + ... form code ... |
| 408 | + {% endspaceless %} |
| 409 | + {% endblock form_errors %} |
370 | 410 |
|
371 |
| - * deprecated FieldType and merged it into FormType |
| 411 | + {% block field_errors %} |
| 412 | + {% spaceless %} |
| 413 | + ... field code ... |
| 414 | + {% endspaceless %} |
| 415 | + {% endblock field_errors %} |
| 416 | + ``` |
| 417 | +
|
| 418 | + After: |
| 419 | +
|
| 420 | + ``` |
| 421 | + {% block form_errors %} |
| 422 | + {% spaceless %} |
| 423 | + {% if primitive %} |
| 424 | + ... field code ... |
| 425 | + {% else %} |
| 426 | + ... form code ... |
| 427 | + {% endif %} |
| 428 | + {% endspaceless %} |
| 429 | + {% endblock form_errors %} |
| 430 | + ``` |
| 431 | +
|
| 432 | + Furthermore, the block "generic_label" was merged into "form_label". You |
| 433 | + should now override "form_label" in order to customize labels. |
| 434 | +
|
| 435 | + Last but not least, the block "widget_choice_options" was renamed to |
| 436 | + "choice_widget_options" to be consistent with the rest of the default |
| 437 | + theme. |
372 | 438 |
|
373 |
| - * [BC BREAK] renamed "field_*" theme blocks to "form_*" and "field_widget" to |
374 |
| - "input" |
375 |
| - |
376 | 439 | * The method `guessMinLength()` of FormTypeGuesserInterface was deprecated
|
377 | 440 | and will be removed in Symfony 2.3. You should use the new method
|
378 | 441 | `guessPattern()` instead which may return any regular expression that
|
379 | 442 | is inserted in the HTML5 attribute "pattern".
|
380 |
| - |
| 443 | +
|
381 | 444 | Before:
|
382 |
| - |
| 445 | +
|
383 | 446 | public function guessMinLength($class, $property)
|
384 | 447 | {
|
385 | 448 | if (/* condition */) {
|
386 | 449 | return new ValueGuess($minLength, Guess::LOW_CONFIDENCE);
|
387 | 450 | }
|
388 | 451 | }
|
389 |
| - |
| 452 | +
|
390 | 453 | After:
|
391 |
| - |
| 454 | +
|
392 | 455 | public function guessPattern($class, $property)
|
393 | 456 | {
|
394 | 457 | if (/* condition */) {
|
|
470 | 533 | `validate` and its return value was dropped.
|
471 | 534 |
|
472 | 535 | `ConstraintValidator` still contains the deprecated `isValid` method and
|
473 |
| - forwards `validate` calls to `isValid` by default. This BC layer will be |
| 536 | + forwards `validate` calls to `isValid` by default. This BC layer will be |
474 | 537 | removed in Symfony 2.3. You are advised to rename your methods. You should
|
475 | 538 | also remove the return values, which have never been used by the framework.
|
476 | 539 |
|
|
500 | 563 | $this->context->addViolation($constraint->message, array(
|
501 | 564 | '{{ value }}' => $value,
|
502 | 565 | ));
|
503 |
| - |
| 566 | +
|
504 | 567 | return;
|
505 | 568 | }
|
506 | 569 | }
|
|
0 commit comments