forked from willdurand/workshop-rest-from-zero-to-hero
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppKernel.php
63 lines (50 loc) · 2.2 KB
/
AppKernel.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
// 1. FOSRestBundle (+ JMSSerializerBundle)
new FOS\RestBundle\FOSRestBundle(),
new JMS\SerializerBundle\JMSSerializerBundle(),
// Useful to directly return "View" objects
// cf. http://symfony.com/doc/master/bundles/FOSRestBundle/3-listener-support.html#view-response-listener
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
// 2. Fixtures
// new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
// new Hautelook\AliceBundle\HautelookAliceBundle(),
// 3. Pagination
// new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
// 4. NelmioApiDocBundle (Documentation)
// new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
// 5. BazingaHateoasBundle (Hypermedia)
// new Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle(),
new Acme\HelloBundle\AcmeHelloBundle()
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
}
return $bundles;
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__ . '/config/config.yml');
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$loader->load(function ($container) {
$container->loadFromExtension('web_profiler', array(
'toolbar' => true,
));
});
}
$app = $this;
$loader->load(function ($container) use ($app) {
$container->setParameter('enable_test', 'test' === $app->getEnvironment());
});
}
}