File tree Expand file tree Collapse file tree 6 files changed +37
-2
lines changed Expand file tree Collapse file tree 6 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ class AppKernel extends Kernel
7
7
{
8
8
public function registerBundles ()
9
9
{
10
+ // When you install a third-party bundle or create a new bundle in your
11
+ // application, you must add it in the following array to register it
12
+ // in the application. Otherwise, the bundle won't be enabled and you
13
+ // won't be able to use it.
10
14
$ bundles = array (
11
15
new Symfony \Bundle \FrameworkBundle \FrameworkBundle (),
12
16
new Symfony \Bundle \SecurityBundle \SecurityBundle (),
@@ -20,6 +24,10 @@ public function registerBundles()
20
24
new AppBundle \AppBundle (),
21
25
);
22
26
27
+ // Some bundles are only used while developing the application or during
28
+ // the unit and functional tests. Therefore, they are only registered
29
+ // when the application runs in 'dev' or 'test' environments. This allows
30
+ // to increase application performance in the production environment.
23
31
if (in_array ($ this ->getEnvironment (), array ('dev ' , 'test ' ))) {
24
32
$ bundles [] = new Symfony \Bundle \DebugBundle \DebugBundle ();
25
33
$ bundles [] = new Symfony \Bundle \WebProfilerBundle \WebProfilerBundle ();
Original file line number Diff line number Diff line change
1
+ {#
2
+ This is the base template of the all backend pages. Since this layout is similar
3
+ to the global layout, we inherit from it to just change the contents of some
4
+ blocks. In practice, backend templates are using a three-level inheritance,
5
+ showing how powerful, yet easy to use, is Twig's inheritance mechanism.
6
+ See http://symfony.com/doc/current/book/templating.html#template-inheritance-and-layouts
7
+ #}
1
8
{% extends ' base.html.twig' %}
2
9
3
10
{% block header_navigation_links %}
Original file line number Diff line number Diff line change
1
+ {#
2
+ This is the base template used as the application layout which contains the
3
+ common elements and decorates all the other templates.
4
+ See http://symfony.com/doc/current/book/templating.html#template-inheritance-and-layouts
5
+ #}
1
6
<!DOCTYPE html>
2
7
<html >
3
8
<head >
Original file line number Diff line number Diff line change
1
+ {#
2
+ This is a template fragment designed to be included in other templates
3
+ See http://symfony.com/doc/current/book/templating.html#including-other-templates
4
+
5
+ A common practice to better distinguish between templates and fragments is to
6
+ prefix fragments with an underscore. That's why this template is called
7
+ '_source_code.html.twig' instead of 'source_code.html.twig'
8
+ #}
1
9
<div class =" section source-code" >
2
10
<p >
3
11
Click on this button to show the source code of the <strong >Controller</strong >
Original file line number Diff line number Diff line change 22
22
/**
23
23
* Controller used to manage blog contents in the backend.
24
24
*
25
+ * Please note that the application backend is developed manually for learning
26
+ * purposes. However, in your real Symfony application you should use any of the
27
+ * existing bundles that let you generate ready-to-use backends without effort.
28
+ * See http://knpbundles.com/keyword/admin
29
+ *
25
30
* @Route("/admin/post")
26
31
* @Security("has_role('ROLE_ADMIN')")
27
32
*
@@ -52,7 +57,7 @@ public function indexAction()
52
57
53
58
return $ this ->render ('admin/blog/index.html.twig ' , array ('posts ' => $ posts ));
54
59
}
55
-
60
+
56
61
/**
57
62
* Creates a new Post entity.
58
63
*
Original file line number Diff line number Diff line change 20
20
use Symfony \Component \DependencyInjection \ContainerInterface ;
21
21
22
22
/**
23
- * Defines the sample data to load in the database when executing this command:
23
+ * Defines the sample data to load in the database when running the unit and
24
+ * functional tests. Execute this command to load the data:
25
+ *
24
26
* $ php app/console doctrine:fixtures:load
25
27
*
26
28
* See http://symfony.com/doc/current/bundles/DoctrineFixturesBundle/index.html
You can’t perform that action at this time.
0 commit comments