1
|
|
|
<?php |
|
|
|
|
2
|
|
|
|
3
|
|
|
use Symfony\Component\HttpKernel\Kernel; |
4
|
|
|
use Symfony\Component\Config\Loader\LoaderInterface; |
5
|
|
|
|
6
|
|
|
require_once __DIR__.'/autoload.php'; |
7
|
|
|
|
8
|
|
|
class AppKernel extends Kernel |
9
|
|
|
{ |
10
|
|
|
public function registerBundles() |
11
|
|
|
{ |
12
|
|
|
$bundles = array( |
13
|
|
|
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), |
14
|
|
|
new Symfony\Bundle\SecurityBundle\SecurityBundle(), |
15
|
|
|
new Symfony\Bundle\TwigBundle\TwigBundle(), |
16
|
|
|
new Symfony\Bundle\MonologBundle\MonologBundle(), |
17
|
|
|
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), |
18
|
|
|
new Symfony\Bundle\AsseticBundle\AsseticBundle(), |
19
|
|
|
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), |
20
|
|
|
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), |
21
|
|
|
|
22
|
|
|
new Mvc\BlogBundle\MvcBlogBundle(), |
23
|
|
|
new Mykees\MediaBundle\MykeesMediaBundle(), |
24
|
|
|
new Mykees\CommentBundle\MykeesCommentBundle(), |
25
|
|
|
new Liip\FunctionalTestBundle\LiipFunctionalTestBundle(), |
26
|
|
|
); |
27
|
|
|
|
28
|
|
|
return $bundles; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @param LoaderInterface $loader |
33
|
|
|
* @return null |
34
|
|
|
*/ |
35
|
|
|
public function registerContainerConfiguration(LoaderInterface $loader) |
36
|
|
|
{ |
37
|
|
|
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml'); |
38
|
|
|
} |
39
|
|
|
/** |
40
|
|
|
* @return string |
41
|
|
|
*/ |
42
|
|
|
public function getCacheDir() |
43
|
|
|
{ |
44
|
|
|
return sys_get_temp_dir().'/'.$this->environment.'/cache'; |
45
|
|
|
} |
46
|
|
|
/** |
47
|
|
|
* @return string |
48
|
|
|
*/ |
49
|
|
|
public function getLogDir() |
50
|
|
|
{ |
51
|
|
|
return sys_get_temp_dir().'/'.$this->environment.'/logs'; |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.