0

我正在尝试借助此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: 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 }

(抱歉,我没有立即将其包括在内,这是办公室的最后 10 分钟:P)。

4

3 回答 3

0

此错误表示您的语法错误

/home/shokora/git/extrastufi/src/ExtraStufi/DatabaseBundle/DependencyInjection/.. /Resources/config/services.yml

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

于 2012-07-31T16:24:10.587 回答
0

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

我仍然不知道 services.yml 出了什么问题,但这有效。

于 2012-08-01T09:10:04.980 回答
0

使用 Yaml 更改 FileLoader 之一:

$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
于 2013-12-19T13:53:14.213 回答