Skip to content

Commit 5fa3822

Browse files
committed
Added more help notes in the application code
1 parent cd2d222 commit 5fa3822

File tree

6 files changed

+37
-2
lines changed

6 files changed

+37
-2
lines changed

app/AppKernel.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ class AppKernel extends Kernel
77
{
88
public function registerBundles()
99
{
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.
1014
$bundles = array(
1115
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
1216
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
@@ -20,6 +24,10 @@ public function registerBundles()
2024
new AppBundle\AppBundle(),
2125
);
2226

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.
2331
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
2432
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
2533
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();

app/Resources/views/admin/layout.html.twig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
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+
#}
18
{% extends 'base.html.twig' %}
29

310
{% block header_navigation_links %}

app/Resources/views/base.html.twig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
#}
16
<!DOCTYPE html>
27
<html>
38
<head>

app/Resources/views/default/_source_code.html.twig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
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+
#}
19
<div class="section source-code">
210
<p>
311
Click on this button to show the source code of the <strong>Controller</strong>

src/AppBundle/Controller/Admin/BlogController.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
/**
2323
* Controller used to manage blog contents in the backend.
2424
*
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+
*
2530
* @Route("/admin/post")
2631
* @Security("has_role('ROLE_ADMIN')")
2732
*
@@ -52,7 +57,7 @@ public function indexAction()
5257

5358
return $this->render('admin/blog/index.html.twig', array('posts' => $posts));
5459
}
55-
60+
5661
/**
5762
* Creates a new Post entity.
5863
*

src/AppBundle/DataFixtures/ORM/LoadFixtures.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
use Symfony\Component\DependencyInjection\ContainerInterface;
2121

2222
/**
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+
*
2426
* $ php app/console doctrine:fixtures:load
2527
*
2628
* See http://symfony.com/doc/current/bundles/DoctrineFixturesBundle/index.html

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy