I use the zend framework 1.11.2. I want to create URLs to controller actions that can be used inside email texts.
Within controllers I have done that with Zend_View_Helper_ServerUrl and Zend_View_Helper_Url like this:
$serverUrlHelper = new Zend_View_Helper_ServerUrl();
$unsubscribeUrl = $serverUrlHelper->serverUrl(
$this->getHelper('url')->url(
array(
'module' => $this->getFrontController()->getDefaultModule(),
'controller' => 'newsletter',
'action' => 'unsubscribe',
'email' => $email
),
'default', // the route
true));
Now I want to do this not within a controller but instead from command line. I already managed to start a zend controller/action by following the steps described here Running a Zend Framework action from command line. But the Application_Router_Cli does not have an implementation for the assemble function. I never have done something deeply with zend routing. Could anyone could please give me an hint how to implement it?
Instead of sub-classing from Zend_Controller_Router_Abstract in Application_Router_Cli (as instructed in that tutorial), subclass from Zend_Controller_Router_Rewrite. This should give you the assemble() function and allow you to use the URL Helper as you would normally use it in a web context.