Pregunta

I am new in symfony, and I see in the documents, that I can get and use validator service in the controller like:

$this->get('validator');

what is the right\easy way to get the validator service in my own service class that i wrote

thank you

¿Fue útil?

Solución

inject it into the service like this

your.service:
    class: Path\To\Your\Service
    arguments: [@validator]
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top