Q:

How can i write Routes dynamically to routes.ini file?

I need to Add Routes to my routes.ini file dynamically.Below is my code.
$appConfigPath = APPLICATION_PATH . '/configs/routes.ini';
$appConfig     = new Zend_Config_Ini($appConfigPath, null,  array('skipExtends' => true,'allowModifications' => true));

$controller = "foo"; $routeName = "bar"; $action = "tar";

$appConfig->production->routes->$routeName->type = "Zend_Controller_Router_Route";
$appConfig->production->routes->$routeName->route = $routeName;
$appConfig->production->routes->$routeName->defaults->controller = $controller;
$appConfig->production->routes->$routeName->defaults->action     =  $action;
$appConfig->production->routes->$routeName->reverse =  $routeName;

$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($appConfig)->setFilename($appConfigPath)->write();

But this is giving me 
Notice: Indirect modification of overloaded property Zend_Config::$bar has no effect in D:\projects\...

Strict Standards: Creating default object from empty value in D:\projects\...

My file is modified but not Added New Changes :( 

A:

I dont think its a good idea, if you want to have dynamic routes use Zend_Controller_Router_Route with dynamic parts.

