S
S
shmaltorhbooks2013-03-17 16:53:28
symfony
shmaltorhbooks, 2013-03-17 16:53:28

Hostname for full URL in Symfony/Console component?

On a project running on SF2.2, you need to generate an RSS feed.
Version 2.2 introduced the ability to generate urls with the full hostname.
But if you use the console, then it is not aware of what the current project's hostname is, or if it even has one. That is, in the feed template, the type construct {{ url('_event', {id: event.getId() }) }}generates a link of the form http://localhost/event/12185, which, of course, is not true.
It goes without saying that you can hardcode the hostname into a template and generate relative links, or you can put the hostname in parameters.yml and use it. What is the smartest way to configure a hostname to generate full links in the console?
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
JekaRu, 2013-03-17
@shmaltorhbooks

Two methods are described here:
symfony.com/doc/master/cookbook/console/sending_emails.html

V
Vyacheslav Slinko, 2013-03-17
@KeepYourMind

parameters.yml

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question