Skip to content

Commit 09bda81

Browse files
committed
Deprecating support for legacy templates directory
1 parent 5d5da2f commit 09bda81

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

configuration/micro_kernel_trait.rst

+7-9
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,12 @@ has one file in it::
267267
}
268268
}
269269

270-
Template files should live in the ``Resources/views/`` directory of whatever directory
271-
your *kernel* lives in. Since ``Kernel`` lives in ``src/``, this template lives
272-
at ``src/Resources/views/micro/random.html.twig``:
270+
Template files should live in the ``templates/`` directory at the root of your project.
271+
This template lives at ``templates/micro/random.html.twig``:
273272

274273
.. code-block:: html+twig
275274

276-
<!-- src/Resources/views/micro/random.html.twig -->
275+
<!-- templates/micro/random.html.twig -->
277276
<!DOCTYPE html>
278277
<html>
279278
<head>
@@ -311,13 +310,12 @@ this:
311310
├─ public/
312311
| └─ index.php
313312
├─ src/
314-
| ├─ Kernel.php
315313
| ├─ Controller
316314
| | └─ MicroController.php
317-
└─ Resources
318-
| └─ views
319-
| └─ micro
320-
| └─ random.html.twig
315+
| └─ Kernel.php
316+
├─ templates/
317+
| └─ micro/
318+
| └─ random.html.twig
321319
├─ var/
322320
| ├─ cache/
323321
│ └─ log/

reference/configuration/twig.rst

+4
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,10 @@ The default directory where Symfony will look for Twig templates.
256256
paths
257257
~~~~~
258258

259+
.. versionadded:: 4.2
260+
The templates directory ``src/Resources/views/`` was deprecated in Symfony 4.2,
261+
use the directory defined in the ``default_path`` option (``templates/`` by default).
262+
259263
**type**: ``array`` **default**: ``null``
260264

261265
This option defines the directories where Symfony will look for Twig templates

0 commit comments

Comments
 (0)