Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bf43001

Browse files
committed
Merge branch '2.2' into 2.3
2 parents ce7fa39 + 4a486ff commit bf43001

File tree

16 files changed

+678
-21
lines changed

16 files changed

+678
-21
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 & 0 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

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/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/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)