7aeefb4d5227f0dee5a71aca7bc02a250e5829cd
[yaffs-website] / vendor / symfony / dependency-injection / Tests / Fixtures / containers / container_uninitialized_ref.php
1 <?php
2
3 use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
4 use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
5 use Symfony\Component\DependencyInjection\ContainerBuilder;
6 use Symfony\Component\DependencyInjection\Reference;
7
8 $container = new ContainerBuilder();
9
10 $container
11     ->register('foo1', 'stdClass')
12     ->setPublic(true)
13 ;
14
15 $container
16     ->register('foo2', 'stdClass')
17     ->setPublic(false)
18 ;
19
20 $container
21     ->register('foo3', 'stdClass')
22     ->setPublic(false)
23 ;
24
25 $container
26     ->register('baz', 'stdClass')
27     ->setProperty('foo3', new Reference('foo3'))
28     ->setPublic(true)
29 ;
30
31 $container
32     ->register('bar', 'stdClass')
33     ->setProperty('foo1', new Reference('foo1', $container::IGNORE_ON_UNINITIALIZED_REFERENCE))
34     ->setProperty('foo2', new Reference('foo2', $container::IGNORE_ON_UNINITIALIZED_REFERENCE))
35     ->setProperty('foo3', new Reference('foo3', $container::IGNORE_ON_UNINITIALIZED_REFERENCE))
36     ->setProperty('closures', array(
37         new ServiceClosureArgument(new Reference('foo1', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)),
38         new ServiceClosureArgument(new Reference('foo2', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)),
39         new ServiceClosureArgument(new Reference('foo3', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)),
40     ))
41     ->setProperty('iter', new IteratorArgument(array(
42         'foo1' => new Reference('foo1', $container::IGNORE_ON_UNINITIALIZED_REFERENCE),
43         'foo2' => new Reference('foo2', $container::IGNORE_ON_UNINITIALIZED_REFERENCE),
44         'foo3' => new Reference('foo3', $container::IGNORE_ON_UNINITIALIZED_REFERENCE),
45     )))
46     ->setPublic(true)
47 ;
48
49 return $container;