1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; |
4
|
|
|
use Symfony\Component\Config\Loader\LoaderInterface; |
5
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
6
|
|
|
use Symfony\Component\HttpKernel\Kernel; |
7
|
|
|
|
8
|
|
|
class AppKernel extends Kernel |
9
|
|
|
{ |
10
|
|
|
use MicroKernelTrait; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @return array |
14
|
|
|
*/ |
15
|
|
|
public function registerBundles() |
16
|
|
|
{ |
17
|
|
|
return [ |
18
|
|
|
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), |
19
|
|
|
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), |
20
|
|
|
// new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), |
|
|
|
|
21
|
|
|
new Galileo\SettingBundle\GalileoSettingBundle(), |
22
|
|
|
]; |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @return string |
27
|
|
|
*/ |
28
|
|
|
public function getCacheDir() |
29
|
|
|
{ |
30
|
|
|
return sys_get_temp_dir().'/cache'.$this->environment; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @return string |
35
|
|
|
*/ |
36
|
|
|
public function getLogDir() |
37
|
|
|
{ |
38
|
|
|
return sys_get_temp_dir().'/logs'; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param ContainerBuilder $c |
43
|
|
|
* @param LoaderInterface $loader |
44
|
|
|
*/ |
45
|
|
|
protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader) |
|
|
|
|
46
|
|
|
{ |
47
|
|
|
$c->loadFromExtension( |
48
|
|
|
'framework', |
49
|
|
|
[ |
50
|
|
|
'secret' => 'my$ecret', |
51
|
|
|
'test' => null, |
52
|
|
|
'templating' => ['engines' => ['php']], |
53
|
|
|
'profiler' => [ |
54
|
|
|
'collect' => false, |
55
|
|
|
], |
56
|
|
|
] |
57
|
|
|
); |
58
|
|
|
$c->loadFromExtension( |
59
|
|
|
'doctrine', |
60
|
|
|
[ |
61
|
|
|
'orm' => [ |
62
|
|
|
'auto_generate_proxy_classes' => "%kernel.debug%", |
63
|
|
|
'naming_strategy' => 'doctrine.orm.naming_strategy.underscore', |
64
|
|
|
'auto_mapping' => true, |
65
|
|
|
// 'entity_managers' => [ |
|
|
|
|
66
|
|
|
// 'defualt' => ['auto_mapping' => true], |
67
|
|
|
// ], |
68
|
|
|
], |
69
|
|
|
'dbal' => [ |
70
|
|
|
'driver' => 'pdo_mysql', |
71
|
|
|
'host' => 'localhost', |
72
|
|
|
'port' => '3306', |
73
|
|
|
'dbname' => 'bundle_test', |
74
|
|
|
'user' => 'tests', |
75
|
|
|
'password' => 'secret', |
76
|
|
|
'charset' => 'UTF8', |
77
|
|
|
], |
78
|
|
|
] |
79
|
|
|
); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Add or import routes into your application. |
84
|
|
|
* |
85
|
|
|
* $routes->import('config/routing.yml'); |
86
|
|
|
* $routes->add('/admin', 'AppBundle:Admin:dashboard', 'admin_dashboard'); |
87
|
|
|
* |
88
|
|
|
* @param \Symfony\Component\Routing\RouteCollectionBuilder $routes |
89
|
|
|
*/ |
90
|
|
|
protected function configureRoutes(\Symfony\Component\Routing\RouteCollectionBuilder $routes) |
|
|
|
|
91
|
|
|
{ |
92
|
|
|
// TODO: Implement configureRoutes() method. |
93
|
|
|
} |
94
|
|
|
} |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.