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

Skip to content

Commit 4d23c70

Browse files
committed
merged branch fabpot/content-renderer-simplification (PR #2179)
This PR was merged into the master branch. Commits ------- 7ab8be5 replaced the proxy route with a listener Discussion ---------- replaced the proxy route with a listener see symfony/symfony#6829
2 parents 65494c8 + 7ab8be5 commit 4d23c70

File tree

2 files changed

+31
-46
lines changed

2 files changed

+31
-46
lines changed

book/http_cache.rst

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -937,41 +937,33 @@ component cache will only last for 60 seconds.
937937

938938
When using a controller reference, the ESI tag should reference the embedded
939939
action as an accessible URL so the gateway cache can fetch it independently of
940-
the rest of the page. Of course, an action can't be accessed via a URL unless
941-
it has a route that points to it. Symfony2 takes care of this via a generic
942-
route. For the ESI include tag to work properly, you must define the ``_proxy``
943-
route:
940+
the rest of the page. Symfony2 takes care of generating a unique URL for any
941+
controller reference and it is able to route them properly thanks to a
942+
listener that must be enabled in your configuration:
944943

945944
.. configuration-block::
946945

947946
.. code-block:: yaml
948947
949-
# app/config/routing.yml
950-
_proxy:
951-
resource: "@FrameworkBundle/Resources/config/routing/proxy.xml"
952-
prefix: /proxy
948+
# app/config/config.yml
949+
framework:
950+
# ...
951+
router_proxy: { path: /_proxy }
953952
954953
.. code-block:: xml
955954
956-
<!-- app/config/routing.xml -->
957-
<?xml version="1.0" encoding="UTF-8" ?>
958-
959-
<routes xmlns="http://symfony.com/schema/routing"
960-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
961-
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
962-
963-
<import resource="@FrameworkBundle/Resources/config/routing/proxy.xml" prefix="/proxy" />
964-
</routes>
955+
<!-- app/config/config.xml -->
956+
<framework:config>
957+
<framework:router-proxy path="/_proxy" />
958+
</framework:config>
965959
966960
.. code-block:: php
967961
968-
// app/config/routing.php
969-
use Symfony\Component\Routing\RouteCollection;
970-
use Symfony\Component\Routing\Route;
971-
972-
$collection->addCollection($loader->import('@FrameworkBundle/Resources/config/routing/proxy.xml', '/proxy'));
973-
974-
return $collection;
962+
// app/config/config.php
963+
$container->loadFromExtension('framework', array(
964+
// ...
965+
'router_proxy' => array('path' => '/_proxy'),
966+
));
975967
976968
One great advantage of this caching strategy is that you can make your
977969
application as dynamic as needed and at the same time, hit the application as

book/templating.rst

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -690,39 +690,32 @@ Symfony2 uses the standard ``render`` helper to configure ``hinclude`` tags:
690690

691691
.. note::
692692

693-
When using a controller instead of an URL, you must enable the Symfony
694-
``proxy`` routing configuration:
693+
When using a controller instead of a URL, you must enable the Symfony
694+
``router_proxy`` configuration:
695695

696696
.. configuration-block::
697697

698698
.. code-block:: yaml
699699
700-
# app/config/routing.yml
701-
_proxy:
702-
resource: "@FrameworkBundle/Resources/config/routing/proxy.xml"
703-
prefix: /proxy
700+
# app/config/config.yml
701+
framework:
702+
# ...
703+
router_proxy: { path: /_proxy }
704704
705705
.. code-block:: xml
706706
707-
<!-- app/config/routing.xml -->
708-
<?xml version="1.0" encoding="UTF-8" ?>
709-
710-
<routes xmlns="http://symfony.com/schema/routing"
711-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
712-
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
713-
714-
<import resource="@FrameworkBundle/Resources/config/routing/proxy.xml" prefix="/proxy" />
715-
</routes>
707+
<!-- app/config/config.xml -->
708+
<framework:config>
709+
<framework:router-proxy path="/_proxy" />
710+
</framework:config>
716711
717712
.. code-block:: php
718713
719-
// app/config/routing.php
720-
use Symfony\Component\Routing\RouteCollection;
721-
use Symfony\Component\Routing\Route;
722-
723-
$collection->addCollection($loader->import('@FrameworkBundle/Resources/config/routing/proxy.xml', '/proxy'));
724-
725-
return $collection;
714+
// app/config/config.php
715+
$container->loadFromExtension('framework', array(
716+
// ...
717+
'router_proxy' => array('path' => '/_proxy'),
718+
));
726719
727720
Default content (while loading or if javascript is disabled) can be set globally
728721
in your application configuration:

0 commit comments

Comments
 (0)