Search code examples
symfonyfosuserbundleparse-error

Symfony2 FOS UserBundle registration form parse error near %fos_user.model.user.class%


I'm trying to build a custom registration form with the help of this https://github.com/FriendsOfSymfony/FOSUserBundle/blob/1.2.0/Resources/doc/overriding_forms.md

I'm following everything to the end but I get the following error:

    ParseException: Unable to parse in "\/home\/shokora\/git\/extrastufi\/src\/ExtraStufi\/DatabaseBundle\/DependencyInjection\/..  \/Resources\/config\/services.yml" at line 10 (near " arguments: [%fos_user.model.user.class%]").


in /home/shokora/git/extrastufi/vendor/symfony/src/Symfony/Component/Yaml/Parser.php line 227
at Parser->parse() in /home/shokora/git/extrastufi/vendor/symfony/src/Symfony/Component/Yaml/Parser.php line 168
at Parser->parse() in /home/shokora/git/extrastufi/vendor/symfony/src/Symfony/Component/Yaml/Parser.php line 168
at Parser->parse() in /home/shokora/git/extrastufi/vendor/symfony/src/Symfony/Component/Yaml/Yaml.php line 73
at Yaml::parse() in /home/shokora/git/extrastufi/vendor/symfony/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php line 242
at YamlFileLoader->loadFile() in /home/shokora/git/extrastufi/vendor/symfony/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php line 42
at YamlFileLoader->load() in /home/shokora/git/extrastufi/src/ExtraStufi/DatabaseBundle/DependencyInjection/ExtraStufiDatabaseExtension.php line 26
at ExtraStufiDatabaseExtension->load() in /home/shokora/git/extrastufi/vendor/symfony/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php line 42
at MergeExtensionConfigurationPass->process() in /home/shokora/git/extrastufi/vendor/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php line 39
at MergeExtensionConfigurationPass->process() in /home/shokora/git/extrastufi/vendor/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php line 119
at Compiler->compile() in /home/shokora/git/extrastufi/vendor/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php line 437
at ContainerBuilder->compile() in /home/shokora/git/extrastufi/app/bootstrap.php.cache line 872
at Kernel->buildContainer() in /home/shokora/git/extrastufi/app/bootstrap.php.cache line 783
at Kernel->initializeContainer() in /home/shokora/git/extrastufi/app/bootstrap.php.cache line 517
at Kernel->boot() in /home/shokora/git/extrastufi/app/bootstrap.php.cache line 548
at Kernel->handle() in /home/shokora/git/extrastufi/web/app_dev.php line 27

The code in services.yml is

parameters:
#    extra_stufi_database.example.class: ExtraStufi\DatabaseBundle\Example

services:
#    extra_stufi_database.example:
#        class: %extra_stufi_database.example.class%
#        arguments: [@service_id, "plain_value", %parameter%]
    extra_stufi_database.registration.form.type:
        class: ExtraStufi\DatabaseBundle\Form\Type\RegistrationFormType
            arguments: [%fos_user.model.user.class%]
            tags:
                - { name: form.type, alias: student_user_registration }

(Sorry that I didn't include this right away, it was the last 10 minutes in the office :P).


Solution

  • Ok, I fixed it by using the XML version of services.yml (services.xml) mentioned on https://github.com/FriendsOfSymfony/FOSUserBundle/blob/1.2.0/Resources/doc/overriding_forms.md

    I still have no idea what was wrong with the services.yml, but this works.