Skip to content

Commit cf2fb97

Browse files
committed
Merge branch '2.7' into 2.8
Conflicts: cookbook/form/dynamic_form_modification.rst
2 parents 92610e3 + b163920 commit cf2fb97

24 files changed

+154
-161
lines changed

book/doctrine.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -953,8 +953,8 @@ To relate the ``Category`` and ``Product`` entities, start by creating a
953953
products:
954954
targetEntity: Product
955955
mappedBy: category
956-
# don't forget to init the collection in the __construct() method
957-
# of the entity
956+
# Don't forget to initialize the collection in
957+
# the __construct() method of the entity
958958
959959
.. code-block:: xml
960960
@@ -1096,7 +1096,7 @@ table, and ``product.category_id`` column, and new foreign key:
10961096
10971097
.. note::
10981098

1099-
This task should only be really used during development. For a more robust
1099+
This command should only be used during development. For a more robust
11001100
method of systematically updating your production database, read about
11011101
`migrations`_.
11021102

@@ -1187,7 +1187,7 @@ You can also query in the other direction::
11871187
// ...
11881188
}
11891189

1190-
In this case, the same things occurs: you first query out for a single ``Category``
1190+
In this case, the same things occur: you first query out for a single ``Category``
11911191
object, and then Doctrine makes a second query to retrieve the related ``Product``
11921192
objects, but only once/if you ask for them (i.e. when you call ``->getProducts()``).
11931193
The ``$products`` variable is an array of all ``Product`` objects that relate

book/forms.rst

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ Handling Form Submissions
225225

226226
The second job of a form is to translate user-submitted data back to the
227227
properties of an object. To make this happen, the submitted data from the
228-
user must be written into the form. Add the following functionality to your
229-
controller::
228+
user must be written into the Form object. Add the following functionality to
229+
your controller::
230230

231231
// ...
232232
use Symfony\Component\HttpFoundation\Request;
@@ -696,9 +696,14 @@ the documentation for each type.
696696
The most common option is the ``required`` option, which can be applied to
697697
any field. By default, the ``required`` option is set to ``true``, meaning
698698
that HTML5-ready browsers will apply client-side validation if the field
699-
is left blank. If you don't want this behavior, either set the ``required``
700-
option on your field to ``false`` or
701-
:ref:`disable HTML5 validation <book-forms-html5-validation-disable>`.
699+
is left blank. If you don't want this behavior, either
700+
:ref:`disable HTML5 validation <book-forms-html5-validation-disable>`
701+
or set the ``required`` option on your field to ``false``::
702+
703+
->add('dueDate', 'date', array(
704+
'widget' => 'single_text',
705+
'required' => false
706+
))
702707

703708
Also note that setting the ``required`` option to ``true`` will **not**
704709
result in server-side validation to be applied. In other words, if a
@@ -937,7 +942,7 @@ specify it:
937942

938943
Some field types have additional rendering options that can be passed
939944
to the widget. These options are documented with each type, but one common
940-
options is ``attr``, which allows you to modify attributes on the form element.
945+
option is ``attr``, which allows you to modify attributes on the form element.
941946
The following would add the ``task_field`` class to the rendered input text
942947
field:
943948

book/templating.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ First, build a base layout file:
201201
<!DOCTYPE html>
202202
<html>
203203
<head>
204-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
204+
<meta charset="UTF-8">
205205
<title>{% block title %}Test Application{% endblock %}</title>
206206
</head>
207207
<body>
@@ -226,7 +226,7 @@ First, build a base layout file:
226226
<!DOCTYPE html>
227227
<html>
228228
<head>
229-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
229+
<meta charset="UTF-8">
230230
<title><?php $view['slots']->output('title', 'Test Application') ?></title>
231231
</head>
232232
<body>
@@ -311,7 +311,7 @@ output might look like this:
311311
<!DOCTYPE html>
312312
<html>
313313
<head>
314-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
314+
<meta charset="UTF-8">
315315
<title>My cool blog posts</title>
316316
</head>
317317
<body>

contributing/code/patches.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ work:
116116
* ``2.3``, if you are fixing a bug for an existing feature (you may have
117117
to choose a higher branch if the feature you are fixing was introduced
118118
in a later version);
119-
* ``2.8``, if you are adding a new feature which is backward compatible;
120-
* ``master``, if you are adding a new and backward incompatible feature.
119+
* ``master``, if you are adding a new feature.
121120

122121
.. note::
123122

cookbook/form/dynamic_form_modification.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,15 @@ you need to register it as a service and tag it with :ref:`form.type <dic-tags-f
374374
.. code-block:: php
375375
376376
// app/config/config.php
377-
$definition = new Definition('AppBundle\Form\Type\FriendMessageFormType');
378-
$definition->addTag('form.type');
379-
$container->setDefinition(
380-
'app.form.friend_message',
381-
$definition,
382-
array('security.token_storage')
377+
use Symfony\Component\DependencyInjection\Reference;
378+
379+
$definition = new Definition(
380+
'AppBundle\Form\Type\FriendMessageFormType',
381+
array(new Reference('security.token_storage'))
383382
);
383+
$definition->addTag('form.type');
384+
385+
$container->setDefinition('app.form.friend_message', $definition);
384386
385387
In a controller that extends the :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller`
386388
class, you can simply call::

cookbook/form/form_customization.rst

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ directly in the template that's actually rendering the form.
264264

265265
.. code-block:: html+twig
266266

267-
{% extends '::base.html.twig' %}
267+
{% extends 'base.html.twig' %}
268268

269269
{% form_theme form _self %}
270270

@@ -303,7 +303,7 @@ can now re-use the form customization across many templates:
303303

304304
.. code-block:: html+twig
305305

306-
{# app/Resources/views/Form/fields.html.twig #}
306+
{# app/Resources/views/form/fields.html.twig #}
307307
{% block integer_widget %}
308308
<div class="integer_widget">
309309
{% set type = type|default('number') %}
@@ -319,7 +319,7 @@ tell Symfony to use the template via the ``form_theme`` tag:
319319

320320
.. code-block:: html+twig
321321

322-
{% form_theme form 'AppBundle:Form:fields.html.twig' %}
322+
{% form_theme form 'form/fields.html.twig' %}
323323

324324
{{ form_widget(form.age) }}
325325

@@ -335,13 +335,12 @@ name of all the templates as an array using the ``with`` keyword:
335335

336336
.. code-block:: html+twig
337337

338-
{% form_theme form with ['::common.html.twig', ':Form:fields.html.twig',
339-
'AppBundle:Form:fields.html.twig'] %}
338+
{% form_theme form with ['common.html.twig', 'form/fields.html.twig'] %}
340339

341340
{# ... #}
342341

343-
The templates can be located at different bundles and they can even be stored
344-
at the global ``app/Resources/views/`` directory.
342+
The templates can also be located in different bundles, use the functional name
343+
to reference these templates, e.g. ``AcmeFormExtraBundle:form:fields.html.twig``.
345344

346345
Child Forms
347346
...........
@@ -350,16 +349,16 @@ You can also apply a form theme to a specific child of your form:
350349

351350
.. code-block:: html+twig
352351

353-
{% form_theme form.child 'AppBundle:Form:fields.html.twig' %}
352+
{% form_theme form.child 'form/fields.html.twig' %}
354353

355354
This is useful when you want to have a custom theme for a nested form that's
356355
different than the one of your main form. Just specify both your themes:
357356

358357
.. code-block:: html+twig
359358

360-
{% form_theme form 'AppBundle:Form:fields.html.twig' %}
359+
{% form_theme form 'form/fields.html.twig' %}
361360

362-
{% form_theme form.child 'AppBundle:Form:fields_child.html.twig' %}
361+
{% form_theme form.child 'form/fields_child.html.twig' %}
363362

364363
.. _cookbook-form-php-theming:
365364

@@ -375,9 +374,13 @@ file in order to customize the ``integer_widget`` fragment.
375374

376375
.. code-block:: html+php
377376

378-
<!-- app/Resources/views/Form/integer_widget.html.php -->
377+
<!-- app/Resources/views/form/integer_widget.html.php -->
379378
<div class="integer_widget">
380-
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : "number")) ?>
379+
<?php echo $view['form']->block(
380+
$form,
381+
'form_widget_simple',
382+
array('type' => isset($type) ? $type : "number")
383+
) ?>
381384
</div>
382385

383386
Now that you've created the customized form template, you need to tell Symfony
@@ -388,7 +391,7 @@ tell Symfony to use the theme via the ``setTheme`` helper method:
388391

389392
.. code-block:: php
390393
391-
<?php $view['form']->setTheme($form, array('AppBundle:Form')); ?>
394+
<?php $view['form']->setTheme($form, array(':form')); ?>
392395
393396
<?php $view['form']->widget($form['age']) ?>
394397
@@ -401,7 +404,14 @@ method:
401404

402405
.. code-block:: php
403406
404-
<?php $view['form']->setTheme($form['child'], 'AppBundle:Form/Child'); ?>
407+
<?php $view['form']->setTheme($form['child'], ':form'); ?>
408+
409+
.. note::
410+
411+
The ``:form`` syntax is based on the functional names for templates:
412+
``Bundle:Directory``. As the form directory lives in the
413+
``app/Resources/views`` directory, the ``Bundle`` part is empty, resulting
414+
in ``:form``.
405415

406416
.. _cookbook-form-twig-import-base-blocks:
407417

@@ -475,8 +485,8 @@ Twig
475485
~~~~
476486

477487
By using the following configuration, any customized form blocks inside the
478-
``AppBundle:Form:fields.html.twig`` template will be used globally when a
479-
form is rendered.
488+
``form/fields.html.twig`` template will be used globally when a form is
489+
rendered.
480490

481491
.. configuration-block::
482492

@@ -485,14 +495,14 @@ form is rendered.
485495
# app/config/config.yml
486496
twig:
487497
form_themes:
488-
- 'AppBundle:Form:fields.html.twig'
498+
- 'form/fields.html.twig'
489499
# ...
490500

491501
.. code-block:: xml
492502
493503
<!-- app/config/config.xml -->
494504
<twig:config>
495-
<twig:form-theme>AppBundle:Form:fields.html.twig</twig:form-theme>
505+
<twig:form-theme>form/fields.html.twig</twig:form-theme>
496506
<!-- ... -->
497507
</twig:config>
498508
@@ -501,7 +511,7 @@ form is rendered.
501511
// app/config/config.php
502512
$container->loadFromExtension('twig', array(
503513
'form_themes' => array(
504-
'AppBundle:Form:fields.html.twig',
514+
'form/fields.html.twig',
505515
),
506516

507517
// ...
@@ -677,7 +687,7 @@ customize the ``name`` field only:
677687
.. code-block:: html+php
678688

679689
<!-- Main template -->
680-
<?php echo $view['form']->setTheme($form, array('AppBundle:Form')); ?>
690+
<?php echo $view['form']->setTheme($form, array(':form')); ?>
681691

682692
<?php echo $view['form']->widget($form['name']); ?>
683693

@@ -735,7 +745,7 @@ You can also override the markup for an entire field row using the same method:
735745
.. code-block:: html+php
736746

737747
<!-- Main template -->
738-
<?php echo $view['form']->setTheme($form, array('AppBundle:Form')); ?>
748+
<?php echo $view['form']->setTheme($form, array(':form')); ?>
739749

740750
<?php echo $view['form']->row($form['name']); ?>
741751

cookbook/security/_ircmaxwell_password-compat.rst.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55

66
.. code-block:: bash
77

8-
$ require ircmaxell/password-compat "~1.0"
8+
$ composer require ircmaxell/password-compat "~1.0"

create_framework/dependency-injection.rst renamed to create_framework/dependency_injection.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ empty class, you might be tempted to move some code from the front controller
77
to it::
88

99
// example.com/src/Simplex/Framework.php
10-
1110
namespace Simplex;
1211

1312
use Symfony\Component\Routing;
@@ -33,7 +32,6 @@ to it::
3332
The front controller code would become more concise::
3433

3534
// example.com/web/front.php
36-
3735
require_once __DIR__.'/../vendor/autoload.php';
3836

3937
use Symfony\Component\HttpFoundation\Request;
@@ -94,7 +92,6 @@ container:
9492
Create a new file to host the dependency injection container configuration::
9593

9694
// example.com/src/container.php
97-
9895
use Symfony\Component\DependencyInjection;
9996
use Symfony\Component\DependencyInjection\Reference;
10097

@@ -147,7 +144,6 @@ it in other object definitions.
147144
The front controller is now only about wiring everything together::
148145

149146
// example.com/web/front.php
150-
151147
require_once __DIR__.'/../vendor/autoload.php';
152148

153149
use Symfony\Component\HttpFoundation\Request;
@@ -165,7 +161,6 @@ As all the objects are now created in the dependency injection container, the
165161
framework code should be the previous simple version::
166162

167163
// example.com/src/Simplex/Framework.php
168-
169164
namespace Simplex;
170165

171166
use Symfony\Component\HttpKernel\HttpKernel;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy