在%FOS_user.model.user.class%附近出现Symfony2 FOS UserBundle注册表单解



我正试图在这个帮助下构建一个自定义注册表https://github.com/FriendsOfSymfony/FOSUserBundle/blob/1.2.0/Resources/doc/overriding_forms.md

我一直在关注一切,但我得到了以下错误:

    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

services.yml中的代码是

parameters:
#    extra_stufi_database.example.class: ExtraStufiDatabaseBundleExample
services:
#    extra_stufi_database.example:
#        class: %extra_stufi_database.example.class%
#        arguments: [@service_id, "plain_value", %parameter%]
    extra_stufi_database.registration.form.type:
        class: ExtraStufiDatabaseBundleFormTypeRegistrationFormType
            arguments: [%fos_user.model.user.class%]
            tags:
                - { name: form.type, alias: student_user_registration }

(很抱歉我没有马上把这个包括在内,这是在办公室的最后10分钟:p)。

此错误表示中存在语法错误

/home/shokora/git/extrastufi/src/extrastufi/DatabaseBundle/DependencyInjection//资源/config/services.yml

文件的第10行。你能公布这个文件的内容吗?

好的,我使用上面提到的services.yml(services.XML)的XML版本修复了它https://github.com/FriendsOfSymfony/FOSUserBundle/blob/1.2.0/Resources/doc/overriding_forms.md

我仍然不知道服务出了什么问题。yml,但这很有效。

用Yaml one更改FileLoader:

$loader = new LoaderYamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

相关内容

最新更新