Hello,
You will have to extend the sfConsoleRequest class. Add in the
missing method getHost(). Just let it return true, I don't think it
needs to return a value.
Then in your factories.yml, replace sfConsoleRequest with your new
class:
cli:
controller:
class: sfConsoleController
request:
class: sfNewConsoleRequest
response:
class: sfConsoleResponse
You'll probably have to tweak things a little further. The
sfConsoleResponse class may have to be extended. I had to go through
this process with my own batch emails. I wanted to use Symfony's
template system to send html emails from the cli. It required these
work-arounds to quiet all the http behaviour.
Kris
On Apr 1, 9:19 am, kusum <[email protected]> wrote:
> Hi,
> please anyone reply this,its very urgent.
>
> Thanks
>
> On Apr 1, 3:11 pm, kusum <[email protected]> wrote:
>
> > Hi,
> > i have set the enviornment cli in my batch script and i am
> > sending mail using this.
>
> > line 401
> > $raw_email=sfContext::getInstance()->getController()->dispatch('mail',
> > 'sendCrmLead', array('param'=>'test'));
>
> > sfContext::getInstance()->getLogger()->debug
> > ($raw_email);
>
> > But i am getting this error
>
> > sfException
> > [message] Call to undefined method sfRequest::getHost
> > [stack trace]
> > at () in SF_SYMFONY_LIB_DIR/request/sfRequest.class.php line 435
> > at sfRequest->__call('getHost', array()) in n/a line n/a
> > at sfConsoleRequest->getHost() in SF_ROOT_DIR/apps/frontend/lib/
> > AgentFilter.php line 24
> > at AgentFilter->execute(object('sfFilterChain')) in
> > SF_SYMFONY_LIB_DIR/filter/sfFilterChain.class.php line 43
> > at sfFilterChain->execute() in SF_SYMFONY_LIB_DIR/filter/
> > sfRenderingFilter.class.php line 33
> > at sfRenderingFilter->execute(object('sfFilterChain')) in
> > SF_SYMFONY_LIB_DIR/filter/sfFilterChain.class.php line 43
> > at sfFilterChain->execute() in SF_SYMFONY_LIB_DIR/controller/
> > sfController.class.php line 276
> > at sfController->forward('mail', 'sendCrmLead') in
> > SF_SYMFONY_LIB_DIR/controller/sfConsoleController.class.php line 34
> > at sfConsoleController->dispatch('mail', 'sendCrmLead', array
> > ('param' => 'test')) in SF_ROOT_DIR/batch/crm_sync.php line 401
>
> > Thanks,
> > Kusum
>
> > On Mar 31, 7:26 pm, Kris <[email protected]> wrote:
>
> > > You can do it by doing something like this:
>
> > > sfContext::getInstance()->getController()->dispatch('myModule',
> > > 'myAction', array('param'=>'test'));
>
> > > The parameters you want to pass are an array.
>
> > > This way you still keep all your code in actions, and you can use
> > > templates you've created for your emails, all from a batch script.
>
> > > Kris
>
> > > On Mar 31, 9:21 am,kusum<[email protected]> wrote:
>
> > > > Hi ,
> > > > how i can send email in batch script using sendEmail and set
> > > > request parameter for email.
>
> > > > Thanks,
> > > > Kusum
> > > > On Mar 31, 5:18 pm,kusum<[email protected]> wrote:
>
> > > > > Hi ,
> > > > > how i can send email in batch script using sendEmail and set
> > > > > request parameter for email.
>
> > > > > Thanks,
> > > > >Kusum
>
> > > > > On Mar 28, 7:43 pm, Kris <[email protected]> wrote:
>
> > > > > > Kasum,
>
> > > > > > Which version of Symfony are you using?
>
> > > > > > In your batch script, do you have:
>
> > > > > > define('SF_ENVIRONMENT', 'cli');
>
> > > > > > This setting will configure Symfony for the console instead of the
> > > > > > web.
>
> > > > > > Kris
>
> > > > > > On Mar 27, 4:44 am,kusum<[email protected]> wrote:
>
> > > > > > > Hi,
> > > > > > > I am sending emails via a batch script.
>
> > > > > > > I need to send parameters to the email module via request
> > > > > > > params
> > > > > > > or
> > > > > > > attributes...
>
> > > > > > > It sends the data and mail is gong proper but gives warnings
> > > > > > > like -
>
> > > > > > > PHP Notice: Undefined index: REQUEST_URI in
> > > > > > > /usr/share/php/symfony/
> > > > > > > request/sfWebRequest.class.php on line 384
> > > > > > > Notice: Undefined index: REQUEST_URI in /usr/share/php/symfony/
> > > > > > > request/
> > > > > > > sfWebRequest.class.php on line 384
> > > > > > > PHP Notice: Undefined index: SERVER_PORT in
> > > > > > > /usr/share/php/symfony/
> > > > > > > request/sfWebRequest.class.php on line 406
>
> > > > > > > Thanks,
> > > > > > >Kusum
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---