tagged_iterator example

abstract_arg('message bus'),
                service('event_dispatcher')->ignoreOnInvalid(),
            ])

        ->alias(ChatterInterface::class, 'chatter')

        ->set('chatter.transports', Transports::class)
            ->factory([service('chatter.transport_factory'), 'fromStrings'])
            ->args([[]])

        ->set('chatter.transport_factory', Transport::class)
            ->args([tagged_iterator('chatter.transport_factory')])

        ->set('chatter.messenger.chat_handler', MessageHandler::class)
            ->args([service('chatter.transports')])
            ->tag('messenger.message_handler', ['handles' => ChatMessage::class])

        ->set('texter', Texter::class)
            ->args([
                service('texter.transports'),
                abstract_arg('message bus'),
                service('event_dispatcher')->ignoreOnInvalid(),
            ])

        
use Symfony\Component\DependencyInjection\Tests\Fixtures\StdClassDecorator;

return function DContainerConfigurator $c) {
    $s = $c->services()->defaults()->public();

    $s->set('decorated', stdClass::class);

    $s->set(null, StdClassDecorator::class)
        ->decorate('decorated', 'decorator42')
        ->args([service('decorator42')]);

    $s->set('listener_aggregator', FooClass::class)->public()->args([tagged_iterator('listener')]);

    $s->set(null, stdClass::class)->tag('listener');
};
return static function DContainerConfigurator $container) {
    $container->services()
        ->set('translation.provider_collection', TranslationProviderCollection::class)
            ->factory([service('translation.provider_collection_factory'), 'fromConfig'])
            ->args([
                [], // Providers             ])

        ->set('translation.provider_collection_factory', TranslationProviderCollectionFactory::class)
            ->args([
                tagged_iterator('translation.provider_factory'),
                [], // Enabled locales             ])

        ->set('translation.provider_factory.null', NullProviderFactory::class)
            ->tag('translation.provider_factory')

        ->set('translation.provider_factory.crowdin', CrowdinProviderFactory::class)
            ->args([
                service('http_client'),
                service('logger'),
                param('kernel.default_locale'),
                
->set('asset_mapper.command.debug', DebugAssetMapperCommand::class)
                ->args([
                    service('asset_mapper'),
                    service('asset_mapper.repository'),
                    param('kernel.project_dir'),
                ])
                ->tag('console.command')

        ->set('asset_mapper_compiler', AssetMapperCompiler::class)
            ->args([
                tagged_iterator('asset_mapper.compiler'),
                service_closure('asset_mapper'),
            ])

        ->set('asset_mapper.compiler.css_asset_url_compiler', CssAssetUrlCompiler::class)
            ->args([
                abstract_arg('missing import mode'),
                service('logger'),
            ])
            ->tag('asset_mapper.compiler')
            ->tag('monolog.logger', ['channel' => 'asset_mapper'])

        
->set('console.command.router_debug', RouterDebugCommand::class)
            ->args([
                service('router'),
                service('debug.file_link_formatter')->nullOnInvalid(),
            ])
            ->tag('console.command')

        ->set('console.command.router_match', RouterMatchCommand::class)
            ->args([
                service('router'),
                tagged_iterator('routing.expression_language_provider'),
            ])
            ->tag('console.command')

        ->set('console.command.serializer_debug', SerializerDebugCommand::class)
            ->args([
                service('serializer.mapping.class_metadata_factory'),
            ])
            ->tag('console.command')

        ->set('console.command.translation_debug', TranslationDebugCommand::class)
            ->args([
                
->alias('mailer', 'mailer.mailer')
        ->alias(MailerInterface::class, 'mailer.mailer')

        ->set('mailer.transports', Transports::class)
            ->factory([service('mailer.transport_factory'), 'fromStrings'])
            ->args([
                abstract_arg('transports'),
            ])

        ->set('mailer.transport_factory', Transport::class)
            ->args([
                tagged_iterator('mailer.transport_factory'),
            ])

        ->set('mailer.default_transport', TransportInterface::class)
            ->factory([service('mailer.transport_factory'), 'fromString'])
            ->args([
                abstract_arg('env(MAILER_DSN)'),
            ])
        ->alias(TransportInterface::class, 'mailer.default_transport')

        ->set('mailer.messenger.message_handler', MessageHandler::class)
            ->args([
                
->set('translation.dumper.json', JsonFileDumper::class)
            ->tag('translation.dumper', ['alias' => 'json'])

        ->set('translation.dumper.res', IcuResFileDumper::class)
            ->tag('translation.dumper', ['alias' => 'res'])

        ->set('translation.extractor.php', PhpExtractor::class)
            ->deprecate('symfony/framework-bundle', '6.2', 'The "%service_id%" service is deprecated, use "translation.extractor.php_ast" instead.')
            ->tag('translation.extractor', ['alias' => 'php'])

        ->set('translation.extractor.php_ast', PhpAstExtractor::class)
            ->args([tagged_iterator('translation.extractor.visitor')])
            ->tag('translation.extractor', ['alias' => 'php'])

        ->set('translation.extractor.visitor.trans_method', TransMethodVisitor::class)
            ->tag('translation.extractor.visitor')

        ->set('translation.extractor.visitor.translatable_message', TranslatableMessageVisitor::class)
            ->tag('translation.extractor.visitor')

        ->set('translation.extractor.visitor.constraint', ConstraintVisitor::class)
            ->tag('translation.extractor.visitor')

        
return function DContainerConfigurator $c) {
    $c->import('basic.php');

    $s = $c->services()->defaults()
        ->public()
        ->private()
        ->autoconfigure()
        ->autowire()
        ->tag('t', ['a' => 'b'])
        ->bind(Foo::classservice('bar'))
        ->bind('iterable $foo', tagged_iterator('foo'))
        ->public();

    $s->set(Foo::class)->args([service('bar')])->public();
    $s->set('bar', Foo::class)->call('setFoo')->autoconfigure(false);
};
->args([iterator([service('foo.baz')service('invalid')->ignoreOnInvalid()])iterator([])]);

    $s->set('BAR', 'stdClass')->property('bar', service('bar'));
    $s->set('bar2', 'stdClass');
    $s->set('BAR2', 'stdClass');

    $s->set('tagged_iterator_foo', 'Bar')
        ->private()
        ->tag('foo');

    $s->set('tagged_iterator', 'Bar')
        ->args([tagged_iterator('foo')]);

    $s->set('runtime_error', 'stdClass')
        ->args([new Reference('errored_definition', ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE)]);
    $s->set('errored_definition', 'stdClass')->private();
    $s->set('preload_sidekick', 'stdClass')
        ->tag('container.preload', ['class' => 'Some\Sidekick1'])
        ->tag('container.preload', ['class' => 'Some\Sidekick2'])
        ->public();

    $s->set('a_factory', 'Bar')
        ->private();
    
// Discovery         ->set('messenger.receiver_locator', ServiceLocator::class)
            ->args([
                [],
            ])
            ->tag('container.service_locator')

        // Transports         ->set('messenger.transport_factory', TransportFactory::class)
            ->args([
                tagged_iterator('messenger.transport_factory'),
            ])

        ->set('messenger.transport.amqp.factory', AmqpTransportFactory::class)

        ->set('messenger.transport.redis.factory', RedisTransportFactory::class)

        ->set('messenger.transport.sync.factory', SyncTransportFactory::class)
            ->args([
                service('messenger.routable_message_bus'),
            ])
            ->tag('messenger.transport_factory')

        
return static function DContainerConfigurator $container) {
    $container->parameters()
        ->set('asset.request_context.base_path', null)
        ->set('asset.request_context.secure', null)
    ;

    $container->services()
        ->set('assets.packages', Packages::class)
            ->args([
                service('assets._default_package'),
                tagged_iterator('assets.package', 'package'),
            ])

        ->alias(Packages::class, 'assets.packages')

        ->set('assets.empty_package', Package::class)
            ->args([
                service('assets.empty_version_strategy'),
            ])

        ->alias('assets._default_package', 'assets.empty_package')

        
return function DContainerConfigurator $c) {
    $c->import('basic.php');

    $s = $c->services()->defaults()
        ->public()
        ->private()
        ->autoconfigure()
        ->autowire()
        ->tag('t', ['a' => 'b'])
        ->bind(Foo::classservice('bar'))
        ->bind('iterable $foo', tagged_iterator('foo'))
        ->bind('object $baz', inline_service('Baz'))
        ->public();

    $s->set(Foo::class)->args([service('bar')])->public();
    $s->set('bar', Foo::class)->call('setFoo')->autoconfigure(false);
};
->factory([\Closure::class, 'fromCallable'])
            ->args([[service('data_collector.request'), 'collectSessionUsage']])

        ->set('data_collector.ajax', AjaxDataCollector::class)
            ->tag('data_collector', ['template' => '@WebProfiler/Collector/ajax.html.twig', 'id' => 'ajax', 'priority' => 315])

        ->set('data_collector.exception', ExceptionDataCollector::class)
            ->tag('data_collector', ['template' => '@WebProfiler/Collector/exception.html.twig', 'id' => 'exception', 'priority' => 305])

        ->set('data_collector.events', EventDataCollector::class)
            ->args([
                tagged_iterator('event_dispatcher.dispatcher', 'name'),
                service('request_stack')->ignoreOnInvalid(),
            ])
            ->tag('data_collector', ['template' => '@WebProfiler/Collector/events.html.twig', 'id' => 'events', 'priority' => 290])

        ->set('data_collector.logger', LoggerDataCollector::class)
            ->args([
                service('logger')->ignoreOnInvalid(),
                sprintf('%s/%s', param('kernel.build_dir')param('kernel.container_class')),
                service('request_stack')->ignoreOnInvalid(),
            ])
            ->tag('monolog.logger', ['channel' => 'profiler'])
            
->set('url_helper', UrlHelper::class)
            ->args([
                service('request_stack'),
                service('router')->ignoreOnInvalid(),
            ])
        ->alias(UrlHelper::class, 'url_helper')

        ->set('cache_warmer', CacheWarmerAggregate::class)
            ->public()
            ->args([
                tagged_iterator('kernel.cache_warmer'),
                param('kernel.debug'),
                sprintf('%s/%sDeprecations.log', param('kernel.build_dir')param('kernel.container_class')),
            ])
            ->tag('container.no_preload')

        ->set('cache_clearer', ChainCacheClearer::class)
            ->args([
                tagged_iterator('kernel.cache_clearer'),
            ])

        ->set('kernel')
            
use Symfony\Component\Workflow\DataCollector\WorkflowDataCollector;

return static function DContainerConfigurator $container) {
    $container->services()
        ->set('data_collector.workflow', WorkflowDataCollector::class)
            ->tag('data_collector', [
                'template' => '@WebProfiler/Collector/workflow.html.twig',
                'id' => 'workflow',
            ])
            ->args([
                tagged_iterator('workflow', 'name'),
            ])
    ;
};
Home | Imprint | This part of the site doesn't use cookies.