سؤال

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