forked from AyrtonRicardo/dependency-injection
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
35 lines (23 loc) · 1.03 KB
/
index.php
File metadata and controls
35 lines (23 loc) · 1.03 KB
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
<?php
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Debug\Debug;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Vox\Treinamento\Exercicio1\Exercicio1Extension;
require 'vendor/autoload.php';
Debug::enable();
$container = new ContainerBuilder();
$extension = new Exercicio1Extension();
$container->registerExtension($extension);
$container->loadFromExtension($extension->getAlias());
//$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/Resources/config'));
//$loader->load('services.yml');
$container->setParameter('exercicio1.numero_pedido' , 2);
$container->compile();
$pedido = $container->get('exercicio1.pedido');
//$container->setParameter('exercicio1.espresso');
$espresso = $container->get('exercicio1.espresso');
$espresso->addAdicional($container->get('exercicio1.chocolate'));
$espresso->addAdicional($container->get('exercicio1.rapadura'));
$pedido->addPedido($espresso);
print_r($pedido->toString());