@@ -2,9 +2,10 @@ The Architecture
2
2
================
3
3
4
4
You are my hero! Who would have thought that you would still be here after the
5
- first three parts? Your efforts will be well-rewarded soon. The first three
6
- parts didn't look too deeply at the architecture of the framework. As it makes
7
- Symfony2 stand apart from the framework crowd, let's dive into it now.
5
+ first three parts? Your efforts will be well rewarded soon. The first three
6
+ parts didn't look too deeply at the architecture of the framework. Because it
7
+ makes Symfony2 stand apart from the framework crowd, let's dive in to the
8
+ architecture now.
8
9
9
10
Understanding the Directory Structure
10
11
-------------------------------------
@@ -237,11 +238,11 @@ specific configuration file:
237
238
Extending a Bundle
238
239
~~~~~~~~~~~~~~~~~~
239
240
240
- In addition to be a nice way to organize and configure your code, a bundle can
241
- extend another one (bundles support inheritance). It allows you to override
242
- any existing bundle to customize its controllers, templates, and any file it
243
- contains. This is where the logical names come in handy as they abstract where
244
- the resource is actually stored.
241
+ In addition to being a nice way to organize and configure your code, a bundle
242
+ can extend another one. Bundle inheritance allows you to override any existing
243
+ bundle to customize its controllers, templates, and any of its files. This is
244
+ where the logical names come in handy, because they abstract where the resource
245
+ is actually stored.
245
246
246
247
For controllers, Symfony2 will automatically choose the right file according
247
248
to the bundle inheritance tree.
@@ -257,10 +258,11 @@ For controllers, you need to reference method names:
257
258
``AcmeDemoBundle:Welcome:index `` means the ``indexAction `` method from the
258
259
``Acme\DemoBundle\Controller\WelcomeController `` class.
259
260
260
- For templates, it is even more interesting as templates do not need to be
261
+ For templates, the logical name ``AcmeDemoBundle:Welcome:index.html.twig `` is
262
+ converted to the file path ``src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig ``.
263
+ Templates become even more interesting when you realize they don't need to be
261
264
stored on the filesystem. You can easily store them in a database table for
262
- instance. For instance, ``AcmeDemoBundle:Welcome:index.html.twig `` is
263
- converted to ``src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig ``.
265
+ instance.
264
266
265
267
Do you understand now why Symfony2 is so flexible? Share your bundles between
266
268
applications, store them locally or globally, your choice.
@@ -276,9 +278,9 @@ templating system, and some other third party libraries and bundles.
276
278
Understanding the Cache and Logs
277
279
--------------------------------
278
280
279
- Symfony2 is probably one of the fastest full-stack frameworks around. But how
281
+ Symfony2 is probably one of the fastest full-stack frameworks around. How
280
282
can it be so fast if it parses and interprets tens of YAML and XML files for
281
- each request? This is partly due to its cache system. The application
283
+ each request? The speed is partly due to its cache system. The application
282
284
configuration is only parsed for the very first request and then compiled down
283
285
to plain PHP code stored in the ``app/cache/ `` directory. In the development
284
286
environment, Symfony2 is smart enough to flush the cache when you change a
@@ -312,9 +314,9 @@ Final Thoughts
312
314
--------------
313
315
314
316
Call me crazy, but after reading this part, you should be comfortable with
315
- moving things around and making Symfony2 work for you. Everything is done in
316
- Symfony2 to get out of your way. So, feel free to rename and move directories
317
- around as you see fit.
317
+ moving things around and making Symfony2 work for you. Everything in
318
+ Symfony2 is designed to get out of your way. So, feel free to rename and
319
+ move directories around as you see fit.
318
320
319
321
And that's all for the quick tour. From testing to sending emails, you still
320
322
need to learn a lot to become a Symfony2 master. Ready to dig into these
0 commit comments