问题
This is similar to Symfony3 You have requested a non-existent service "validator.builder", while add FOSUserBundle, on vanilla Symfon3.3 instead of microkernel (in case that makes differences).
Problem:
I have a problem trying to set up FOSUser (v.2) on a Symfony 3.3:
[Symfony\Component\DependencyInjection\Exception\AutowiringFailedException]
Cannot autowire service "validator.builder": argument "$node" of method
"Symfony\Component\Config\Definition\Builder\ValidationBuilder::__construct()"
references class Symfony\Component\Config\Definition\Builder\NodeDefinition"
but no such service exists.
Browsing through online API:
- ValidationBuilder is marked up to the 3.2 branch, although exists in github
- NodeDefinition is also marked up to v3.2, although exists in github
Does that mean that their documentation is not up to date with the master 3.3?
Or not maintained anymore?
Context:
Following the official documentation, I first faced these problems:
- mailer_user cannot be null ; solved by editing parameters.yml: parameters: mailer_user: "me@example.com"
- non-existent-service-validator-builder ; solved by declaring service
validator.builder
non existent parameter kernel secret ; solved by duplicating a line in parameters.yml:
parameters: secret: <-generated-upon-install-> kernel.secret: <-duplicated-line->
I suppose there is a nice and clever way to get out of this problem, if anyone faced it yet?
回答1:
Solved! In service.yml, do not declare service as
validator.builder:
class: Symfony\Component\Config\Definition\Builder\ValidationBuilder
But this way:
Symfony\Component\Config\Definition\Builder\ValidationBuilder:
autowire: true
Once again, the official documentation had the answer!
来源:https://stackoverflow.com/questions/46217177/fosuser-on-symfony-3-3