タスクで URL を生成する必要がありますが、次のタイプの URL が正しくありません。
./symfony/user/edit/id
必要なとき
/user/edit/id
私の最初の試みは:
protected function execute($arguments = array(), $options = array())
{
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', $options['env'], true);
$this->context = sfContext::createInstance($configuration);
$baseurl = $this->context->getController()->genUrl(array('module' => 'user','action' => 'edit', 'id' => $id));
// ...
}
この回答に続く私の2回目の試行は、同じ間違ったURLを提供します:
protected function execute($arguments = array(), $options = array())
{
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', $options['env'], true);
$this->context = sfContext::createInstance($configuration);
$routing = $this->context->getRouting();
$baseurl = $routing->generate('user_edit', array('id' => $id));
// ...
}
正しい URL を取得するにはどうすればよいですか?