Skip to content

Commit 7ed82a0

Browse files
committed
Merge branch '2.3'
2 parents 69be273 + bf43001 commit 7ed82a0

File tree

18 files changed

+681
-26
lines changed

18 files changed

+681
-26
lines changed

book/controller.rst

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,8 @@ perform a 301 (permanent) redirect, modify the second argument::
452452
Forwarding
453453
~~~~~~~~~~
454454

455-
You can also easily forward to another controller internally with the ``forward()``
455+
You can also easily forward to another controller internally with the
456+
:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::forward`
456457
method. Instead of redirecting the user's browser, it makes an internal sub-request,
457458
and calls the specified controller. The ``forward()`` method returns the ``Response``
458459
object that's returned from that controller::
@@ -492,17 +493,22 @@ value to each variable.
492493

493494
Like other base ``Controller`` methods, the ``forward`` method is just
494495
a shortcut for core Symfony2 functionality. A forward can be accomplished
495-
directly via the ``http_kernel`` service and returns a ``Response``
496-
object::
496+
directly by duplicating the current request. When this
497+
:ref:`sub request<http-kernel-sub-requests>` is executed via the ``http_kernel``
498+
service the ``HttpKernel`` returns a ``Response`` object::
499+
500+
use Symfony\Component\HttpKernel/HttpKernelInterface;
501+
502+
$path = array(
503+
'_controller' => 'AcmeHelloBundle:Hello:fancy',
504+
'name' => $name,
505+
'color' => 'green',
506+
);
507+
$request = $this->container->get('request');
508+
$subRequest = $request->duplicate(array(), null, $path);
497509

498510
$httpKernel = $this->container->get('http_kernel');
499-
$response = $httpKernel->forward(
500-
'AcmeHelloBundle:Hello:fancy',
501-
array(
502-
'name' => $name,
503-
'color' => 'green',
504-
)
505-
);
511+
$response = $httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
506512

507513
.. index::
508514
single: Controller; Rendering templates

book/forms.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,8 @@ querying if the "Save and add" button was clicked::
307307
.. index::
308308
single: Forms; Validation
309309

310+
.. _book-forms-form-validation:
311+
310312
Form Validation
311313
---------------
312314

@@ -731,8 +733,6 @@ of code. Of course, you'll usually need much more flexibility when rendering:
731733

732734
{{ form_row(form.task) }}
733735
{{ form_row(form.dueDate) }}
734-
735-
<input type="submit" />
736736
{{ form_end(form) }}
737737

738738
.. code-block:: html+php
@@ -743,8 +743,6 @@ of code. Of course, you'll usually need much more flexibility when rendering:
743743

744744
<?php echo $view['form']->row($form['task']) ?>
745745
<?php echo $view['form']->row($form['dueDate']) ?>
746-
747-
<input type="submit" />
748746
<?php echo $view['form']->end($form) ?>
749747

750748
Take a look at each part:

book/propel.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,5 +479,5 @@ You should read the dedicated section for `Propel commands in Symfony2`_.
479479
.. _`Working With Symfony2`: http://propelorm.org/cookbook/symfony2/working-with-symfony2.html#installation
480480
.. _`PropelBundle configuration section`: http://propelorm.org/cookbook/symfony2/working-with-symfony2.html#configuration
481481
.. _`Relationships`: http://propelorm.org/documentation/04-relationships.html
482-
.. _`Behaviors reference section`: http://propelorm.org/documentation/#behaviors_reference
483-
.. _`Propel commands in Symfony2`: http://propelorm.org/cookbook/symfony2/working-with-symfony2#the_commands
482+
.. _`Behaviors reference section`: http://propelorm.org/documentation/#behaviors-reference
483+
.. _`Propel commands in Symfony2`: http://propelorm.org/cookbook/symfony2/working-with-symfony2#the-commands

book/templating.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,8 @@ string syntax for controllers (i.e. **bundle**:**controller**:**action**):
670670
Whenever you find that you need a variable or a piece of information that
671671
you don't have access to in a template, consider rendering a controller.
672672
Controllers are fast to execute and promote good code organization and reuse.
673+
Of course, like all controllers, they should ideally be "skinny", meaning
674+
that as much code as possible lives in reusable :doc:`services</book/service_container>`.
673675

674676
Asynchronous Content with hinclude.js
675677
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

components/console/events.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ the wheel, it uses the Symfony EventDispatcher component to do the work::
1414
use Symfony\Component\Console\Application;
1515
use Symfony\Component\EventDispatcher\EventDispatcher;
1616

17+
$dispatcher = new EventDispatcher();
18+
1719
$application = new Application();
1820
$application->setDispatcher($dispatcher);
1921
$application->run();

components/dependency_injection/parameters.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,12 @@ Start the string with ``@`` or ``@?`` to reference a service in Yaml.
337337
* ``@?mailer`` references the ``mailer`` service. If the service does not
338338
exists, it will be ignored;
339339

340+
.. tip::
341+
342+
Use ``@@`` to escape the ``@`` symbol in Yaml. ``@@mailer`` will be
343+
converted into the string ``"@mailer"`` instead of referencing the
344+
``mailer`` service.
345+
340346
Xml
341347
~~~
342348

components/finder.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ Exclude directories from matching with the
9797
$finder->in(__DIR__)->exclude('ruby');
9898

9999
.. versionadded:: 2.3
100-
The :method:`Symfony\\Component\\Finder\\Finder::ignoreUnreadableDirs``
100+
The :method:`Symfony\\Component\\Finder\\Finder::ignoreUnreadableDirs`
101101
method was added in Symfony 2.3.
102102

103103
It's also possible to ignore directories that you don't have permission to read::

components/form/index.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Form
2+
====
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
7+
introduction

0 commit comments

Comments
 (0)