# config/services.yaml
services:
    _defaults:
        autowire: true          # Automatically injects dependencies in your services.
        autoconfigure: true     # Automatically registers your services as commands, event subscribers, etc.
        public: false           # Allows optimizing the container by removing unused services; this also means
                                # fetching services directly from the container via $container->get() won't work.
                                # The best practice is to be explicit about your dependencies anyway.
        bind:
            #$projectDir: '%kernel.project_dir%'

    Dud\ContaoMathe\Controller\Backend\MathResultsController:
        tags:
            - { name: contao.backend_module, module: math_competition }

    Dud\ContaoMathe\:
        resource: ../src/
        exclude: ../src/{DependencyInjection,Model,Session}

    # Add a session bag
    dud.contao_mathe.session.factory:
        class: Dud\ContaoMathe\Session\SessionFactory
        decorates: session.factory
        arguments:
            - '@dud.contao_mathe.session.factory.inner'
            - '@dud.contao_mathe.session.attribute.array_attribute_bag'

    dud.contao_mathe.session.attribute.array_attribute_bag:
        class: Dud\ContaoMathe\Session\Attribute\ArrayAttributeBag
        arguments:
            - _dud_contao_mathe_attributes
        calls:
            - [ setName, [ dud_contao_mathe ] ]
