A quick google search found something that can explain it for you.
Basically, url_for uses the $_SERVER variables which in command line
obviously does not exist:

https://groups.google.com/group/symfony-users/msg/f71d8c3f819060f9?hl=fr&pli=1

On Tue, Nov 9, 2010 at 12:10 PM, hribo <hribo...@gmail.com> wrote:

> that's not the case.
> i am able to generate url also with url_for. in my script i am using
> loaded helpers. but the case is that when i am using these helpers,
> the LINK IS GENERATED BADLY. helpers prefixes: "symfony/symfony/" in
> front of each well generated url.
> when i am using this url helpers in action or in template, it works
> correctly.
>
> did anybody headed this problem? or is it some kind of symfony bug?
> thank you
>
>
> On Nov 9, 7:06 am, Gareth McCumskey <gmccums...@gmail.com> wrote:
> > Tasks do not load the html helpers by default because, well, they do not
> run
> > on the web server but on the comman line. To load the helper file for
> > url_for you need to load the Url helper as such:
> >
> > sfLoader::loadHelpers(array('Url'));
> >
> > Then you can go ahead and use url_for to build your url.
> >
> >
> >
> > On Mon, Nov 8, 2010 at 6:21 PM, hribo <hribo...@gmail.com> wrote:
> > > hello i have problem with generating url inside of task.
> > > i have tried already 3 different ways to generate it but always with
> > > same result - with symfony/symfony/ prefix at the beginning:
> >
> > > symfony/symfony/reminder_set_to_is_returned/{$token_id} - WRONG
> > > reminder_set_to_is_returned/{$token_id} - THIS SHOULD BE THE RESULT
> >
> > > these are my ways to generate url inside of task:
> > > url_for('reminder/activateUserReminderIsActive?tokenizer='.$reminder-
> > > >setTokenizer('borrower'));
> >
> > > sfContext::createInstance($configuration)->getRouting()-
> > > >generate('reminder_set_to_is_returned', array('tokenizer' =>
> > > $reminder->setTokenizer('borrower')));
> >
> > > sfContext::createInstance($configuration)->getController()-
> > > >genUrl('reminder/reminderSetToIsReturned?tokenizer='.$reminder-
> > > >setTokenizer('borrower'));
> >
> > > do you know where is the problem?
> > > thank you
> >
> > > --
> > > If you want to report a vulnerability issue on symfony, please send it
> to
> > > security at symfony-project.com
> >
> > > You received this message because you are subscribed to the Google
> > > Groups "symfony users" group.
> > > To post to this group, send email to symfony-users@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> <symfony-users%2bunsubscr...@googlegroups.com<symfony-users%252bunsubscr...@googlegroups.com>
> >
> > > For more options, visit this group at
> > >http://groups.google.com/group/symfony-users?hl=en
> >
> > --
> > Gareth McCumskeyhttp://garethmccumskey.blogspot.com
> > twitter: @garethmcc
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>



-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to