문제

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

도움이 되었습니까?

해결책

inject it into the service like this

your.service:
    class: Path\To\Your\Service
    arguments: [@validator]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top