Usar rutas para generar URL en una tarea de Symfony
Estoy corriendoSymfony 1.3.6 en Ubuntu 10.0.4 LTS.
He escrito una tarea de Symfony que genera un informe que contiene enlaces (URL).
Aquí hay un fragmento de laexecute()
método en mi clase de tarea:
protected function execute($arguments = array(), $options = array())
{
//create a context
sfContext::createInstance($this->configuration);
sfContext::getInstance()->getConfiguration()->loadHelpers(array('Url', 'Asset', 'Tag'));
...
$url = url_for("@foobar?cow=marymoo&id=42");
// Line 1
echo '<a href="'.$url.'">This is a test</a>';
// Line 2
echo link_to('This is a test', $url);
}
El nombre de la ruta se define así:
foobar:
url: /some/fancy/path/:cow/:id/hello.html
param: { module: mymodule, action: myaction }
Cuando esto se ejecuta, el enlace generado es:
Línea 1 produce esta salida:
./symfony/symfony/some/fancy/path/marymoo/42/hello.html
en lugar de lo esperado:
/some/fancy/path/marymoo/42/hello.html
Línea 2 genera un error:
No se puede encontrar una ruta coincidente para generar la URL para los parámetros "array ('action' => 'symfony', 'module' => '.',)".
De nuevo, la URL esperada es:
/some/fancy/path/marymoo/42/hello.html
¿Cómo puedo resolver esto?