Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all articles
Browse latest Browse all 3925

Get base url on symfony 3.4 command

$
0
0

I'm trying to get the base url on a command to get localhost on local and the production url on producction but all the exmaples I found are using the reuqest object but Idon't have it on a command:

class PasswordExpirationCommand extends Command{    private $ms;    private $translator;    private $em;    public function __construct(MailService $ms, TranslatorInterface $translator, EntityManagerInterface $em)    {        parent::__construct();        $this->ms = $ms;        $this->translator = $translator;        $this->em = $em;    }    protected function configure()    {        $this            ->setName('app:password:expiration')            ->setDescription('Expire 3 months old password');    }    /**     *     *       *     * @param InputInterface $input     * @param OutputInterface $output     * @return int|void|null     */    protected function execute(InputInterface $input, OutputInterface $output)    {        $base_url =....//need http://localhost/ or https://production_url         //reminders        $this->passwordExpirationReminder();    }

Viewing all articles
Browse latest Browse all 3925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>