services.yml语法错误?Symfony


services.yml syntax error? Symfony

此YML文件中一定存在语法错误。因为例如,正如目前的情况一样,我得到了这个错误:

The function "appPendingTasks" does not exist in ::layout.html.twig at line 64 

但是,如果我删除twig.extension.show.responses块,它会正常工作!(除了当我加载需要show.responses的页面时,这显然不起作用)。

有人看到这个有什么不对吗?

# Learn more about services, parameters and containers at
# http://symfony.com/doc/current/book/service_container.html
parameters:
#    parameter_name: value
services:
    twig.extension.pending.tasks:
      class: MyApp'TaskBundle'Extensions'PendingTasksExtension
      arguments: [@doctrine.orm.entity_manager]
      tags:
        - { name: twig.extension }
    twig.extension.show.responses:
      class: MyApp'TaskBundle'Extensions'ShowResponsesExtension
      arguments: [@doctrine.orm.entity_manager]
      tags:
        - { name: twig.extension }
    twig.extension.show.question:
      class: MyApp'TaskBundle'Extensions'ShowQuestionExtension
      arguments: [@doctrine.orm.entity_manager]
      tags:
        - { name: twig.extension }

服务定义的语法正确,请检查两个类PendingTasksExtensionShowResponsesExtension的差异。

我假设在getName函数中定义了相同的名称

在其他尝试中,您可以颠倒服务定义的顺序:我预计现在的错误是其他函数。

希望这能帮助