Skip to content

Commit bc3618d

Browse files
committed
Made a bunch of fixes recommended by Ryan
1 parent 2613810 commit bc3618d

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

request/multiple_kernels.rst

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Symfony application.
4444
Step 1) Create a new Front Controller
4545
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4646

47-
Instead of creating the new front controller from scratch, it's recommended to
47+
Instead of creating the new front controller from scratch, it's easier to
4848
duplicate the existing ones. For example, create ``web/api_dev.php`` from
4949
``web/app_dev.php`` and ``web/api.php`` from ``web/app.php``.
5050

@@ -65,16 +65,14 @@ Step 2) Create the new Kernel Class
6565
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6666

6767
Now you need to define the ``ApiKernel`` class used by the new front controller.
68-
The recommendation again is to duplicate the existing ``app/AppKernel.php`` file
69-
and make the needed changes.
68+
The easiest way to do this is by duplicating the existing ``app/AppKernel.php``
69+
file and make the needed changes.
7070

71-
In this example, the changes of the new ``ApiKernel`` would be to load less
72-
bundles than ``AppKernel`` and to change the location of the cache, logs and
73-
config files to not mess with the regular application::
71+
In this example, the ``ApiKernel`` will load less bundles than AppKernel. Be
72+
sure to also change the location of the cache, logs and configuration files so
73+
they don't collide with the files from ``AppKernel``::
7474

7575
// app/ApiKernel.php
76-
<?php
77-
7876
use Symfony\Component\HttpKernel\Kernel;
7977
use Symfony\Component\Config\Loader\LoaderInterface;
8078

@@ -104,9 +102,9 @@ config files to not mess with the regular application::
104102
Step 3) Define the Kernel Configuration
105103
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106104

107-
Finally, define the configuration used by the application when it executes the
108-
new API kernel. According to the previous code, this config must be defined in
109-
the ``app/config/api/`` directory.
105+
Finally, define the configuration files that the new ``ApiKernel`` will load.
106+
According to the above code, this config will live in the ``app/config/api/``
107+
directory.
110108

111109
The new configuration can be created from scratch when you load just a few
112110
bundles, because it will be very simple. Otherwise, duplicate the existing
@@ -130,7 +128,8 @@ script and rename it (e.g. ``bin/api``).
130128

131129
Then, replace the ``AppKernel`` instantiation by your own kernel instantiation
132130
(e.g. ``ApiKernel``) and now you can execute commands using the new kernel
133-
(e.g. ``php bin/api cache:clear``) Now you can use execute commands using the new kernel
131+
(e.g. ``php bin/api cache:clear``) Now you can use execute commands using the
132+
new kernel.
134133

135134
.. note::
136135

@@ -160,7 +159,7 @@ Adding more Kernels to the Application
160159
--------------------------------------
161160

162161
If your application is very complex and you create several kernels, it's better
163-
to store them on their own directories instead of messing with lots of files in
162+
to store them in their own directories instead of messing with lots of files in
164163
the default ``app/`` directory:
165164

166165
.. code-block:: text

0 commit comments

Comments
 (0)