services:
    packagist.twig.extension:
        class: Packagist\WebBundle\Twig\PackagistExtension
        arguments: [ @doctrine ]
        tags:
            - { name: twig.extension }

    packagist.package_dumper:
        class: Packagist\WebBundle\Package\Dumper
        arguments: [ @doctrine, @filesystem, @router, %kernel.root_dir%/../web/, %kernel.cache_dir% ]

    packagist.user_provider:
        class: Packagist\WebBundle\Security\Provider\UserProvider
        public: false
        arguments: ["@fos_user.user_manager"]

    packagist.user_repository:
        class: Packagist\WebBundle\Entity\UserRepository
        factory_service: doctrine
        factory_method: getRepository
        arguments: ["PackagistWebBundle:User"]

    packagist.package_updater:
        class: Packagist\WebBundle\Package\Updater
        arguments: [@doctrine]

    packagist.form.handler.registration:
        class: Packagist\WebBundle\Form\Handler\RegistrationFormHandler
        parent: fos_user.registration.form.handler.default
        scope: request

    fos_user.util.user_manipulator:
        class: Packagist\WebBundle\Util\UserManipulator
        arguments: [@fos_user.user_manager, @fos_user.util.token_generator]

    packagist.oauth.registration_form_handler:
        class: Packagist\WebBundle\Form\Handler\OAuthRegistrationFormHandler
        arguments: [@fos_user.user_manager, @fos_user.util.token_generator]

    packagist.oauth.registration_form_type:
        class: Packagist\WebBundle\Form\Type\OAuthRegistrationFormType
        tags:
            - { name: form.type, alias: packagist_oauth_user_registration }

    packagist.oauth.registration_form:
        factory_method: createNamed
        factory_service: form.factory
        class: Symfony\Component\Form\Form
        arguments:
            - 'packagist_oauth_user_registration'
            - 'packagist_oauth_user_registration'
