我有这个代码
services:
repo.game:
class: Doctrine\ORM\EntityRepository
factory_service: doctrine.orm.default_entity_manager
factory_method: getRepository
arguments:
- AppBundle\Entity\Game
file.upload.listener:
class: AppBundle\Listener\FileUploadListener
arguments: [@repo.game]
tags:
- { name: "kernel.event_listener", event: "oneup_uploader.post_upload", method: "onUpload" }
Run Code Online (Sandbox Code Playgroud)
这在<= 2.8中运行良好,但在3.0中我收到此错误消息
[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException] The file "/ext/thing/app/config/services.yml" does not contain valid YAML.
[Symfony\Component\Yaml\Exception\ParseException]
The reserved indicator "@" cannot start a plain scalar; you need to quote the scalar at line 14 (near "arguments: [@repo.game]").
我的/ext/thing/app/config/services.yml文件中没有其他内容
Mat*_*teo 17
参考yaml部分的UPGRADE指南:
使用@,`,|或>启动不带引号的字符串会导致ParseException.
因此,请尝试按以下方式修改配置:
file.upload.listener:
class: AppBundle\Listener\FileUploadListener
arguments: ["@repo.game"]
tags:
- { name: "kernel.event_listener", event: "oneup_uploader.post_upload", method: "onUpload" }
Run Code Online (Sandbox Code Playgroud)
希望这有帮助
| 归档时间: |
|
| 查看次数: |
3517 次 |
| 最近记录: |