I have this code
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" }
This worked fine in <= 2.8, but here in 3.0 I got this error message
[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]").
There is nothing else in my /ext/thing/app/config/services.yml
file
Referring to the UPGRADE Guide in the yaml section:
Starting an unquoted string with @, `, |, or > leads to a ParseException.
So try to modify your configuration as follow:
file.upload.listener:
class: AppBundle\Listener\FileUploadListener
arguments: ["@repo.game"]
tags:
- { name: "kernel.event_listener", event: "oneup_uploader.post_upload", method: "onUpload" }
Hope this help
First error look like the indent, you have 2 indent space and 4 indent in argument and tags, please try test yml online.
Second symfony 3 is strict now. you need add quote in argument service [@repo.game]
to ["@repo.game"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With