services:
    # default configuration for services in *this* file
    _defaults:
        # automatically injects dependencies in your services
        autowire: true
        # automatically registers your services as commands, event subscribers, etc.
        autoconfigure: true

    # Example custom templating helper
    # app.templating.helper.foobar:
    #    class: AppBundle\Templating\Helper\Example
    #    tags:
    #        - { name: templating.helper, alias: fooBar }

    # Example event listener for objects
    # app.event_listener.test:
    #    class: AppBundle\EventListener\TestListener
    #    tags:
    #        - { name: kernel.event_listener, event: pimcore.object.preUpdate, method: onObjectPreUpdate }

    # auto-register all controllers as services
    AppBundle\Controller\:
        resource: '../../Controller'
        public: true
        tags: ['controller.service_arguments']

    #
    # TEMPLATING
    #

    website_demo.area.brick.blockquote:
        class: AppBundle\Document\Areabrick\Blockquote
        tags:
            - { name: pimcore.area.brick, id: blockquote }

    website_demo.language_switcher:
        class: AppBundle\Templating\LanguageSwitcher
        arguments: ['@Pimcore\Model\Document\Service']

    # adds uniqid function to twig
    website_demo.twig.uniqid_extension:
        class: AppBundle\Twig\UniqidExtension
        public: false
        tags:
            - { name: twig.extension }


    #
    # SECURITY/LOGIN SERVICES
    #
    # The services defined below are referenced from pimcore/security.yml.
    #
    # The user provider loads users by Username.
    # Pimcore provides a simple ObjectUserProvider which is able to load users from a specified class by a configured
    # field. The website_demo.security.user_provider will load users from the AppBundle\Model\DataObject\User by looking at
    # their username field.
    website_demo.security.user_provider:
        class: Pimcore\Security\User\ObjectUserProvider
        arguments: ['AppBundle\Model\DataObject\User', 'username']

    # The encoder factory is responsible for verifying the password hash for a given user. As we need some special
    # handling to be able to work with the password field, we use the UserAwareEncoderFactory to buiild a dedicated
    # encoder per user. This service is configured in pimcore.security.encoder_factories to handle our user model.
    website_demo.security.password_encoder_factory:
        class: Pimcore\Security\Encoder\Factory\UserAwareEncoderFactory
        arguments:
            - Pimcore\Security\Encoder\PasswordFieldEncoder
            - ['password']
