Classes List

Symfony\Component\DependencyInjection\Tests\Fixtures\containers\container_almost_circular

 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 
<?php

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
use Symfony\Component\DependencyInjection\Reference;

$public = 'public' === $visibility;
$container = new ContainerBuilder();

// same visibility for deps

$container->register('foo'FooCircular::class)->setPublic(true)
   ->addArgument(new Reference('bar'));

$container->register('bar'BarCircular::class)->setPublic($public)
    ->addMethodCall('addFoobar'array(new Reference('foobar')));

$container->register('foobar'FoobarCircular::class)->setPublic($public)
    ->addArgument(new Reference('foo'));

// mixed visibility for deps

$container->register('foo2'FooCircular::class)->setPublic(true)
   ->addArgument(new Reference('bar2'));

$container->register('bar2'BarCircular::class)->setPublic(!$public)
    ->addMethodCall('addFoobar'array(new Reference('foobar2')));

$container->register('foobar2'FoobarCircular::class)->setPublic($public)
    ->addArgument(new Reference('foo2'));

// simple inline setter with internal reference

$container->register('bar3'BarCircular::class)->setPublic(true)
    ->addMethodCall('addFoobar'array(new Reference('foobar3'), new Reference('foobar3')));

$container->register('foobar3'FoobarCircular::class)->setPublic($public);

// loop with non-shared dep

$container->register('foo4''stdClass')->setPublic($public)
    ->setShared(false)
    ->setProperty('foobar'new Reference('foobar4'));

$container->register('foobar4''stdClass')->setPublic(true)
    ->addArgument(new Reference('foo4'));

// loop on the constructor of a setter-injected dep with property

$container->register('foo5''stdClass')->setPublic(true)
    ->setProperty('bar'new Reference('bar5'));

$container->register('bar5''stdClass')->setPublic($public)
    ->addArgument(new Reference('foo5'))
    ->setProperty('foo'new Reference('foo5'));

return $container;