Just FYI, you should ask this in fw-contributors for now, maybe you'll get more feedback :)
Marco Pivetta http://twitter.com/Ocramius http://marco-pivetta.com On 30 June 2012 07:50, Bart McLeod <[email protected]> wrote: > Sorry, forget to mention ZF2 > > Op 30-06-12 07:49, Bart McLeod schreef: > > Hi all, > > What I am trying to do is pretty simple, and I can get it to work, but I > encounter unexpected things along the road. > > For example, I have a CfFrontend module and a CfArticle module. Both have > controllers. > > CfFrontend is at http://zf2/ > CfArticle is at http://zf2/article > > These two routes work, and they are configured in the respective > module.config.php files of each module. > > Now two strange things happen: > > 1. If a controller has an alias in the route configuration (i.e. NOT a > class name), and it has an 'invokables' key in the 'controllers' > configuration section with a key for the alias, it is not loaded. Examples > later in this mail. However, if instead of 'invokables', 'factories' is > used (with a valid factory for the alias) then it does work. > > 2. If in the second ('article') module we use the same setup with a valid > factory, the controller is not found. It seems the factories are not > stacked (not merged correctly). The last one loaded takes precedence. The > last module in the application.config.php wins. > > Examples: > module.config.php for 'CfArticle' > > return array( > 'router' => array( > 'routes' => array( > 'cf-article' => array( > 'type' => 'Literal', > 'options' => array( > 'route' => '/article', > 'defaults' => array( > //'controller' => 'article', // factories don't > work here, incorrect merge? > 'controller' => > 'CfArticle\Controller\ArticleController', > 'action' => 'index', > ), > ), > ), > ), > ), > > 'controller' => array( > 'factories' => array( // using invokables is not possible here, > only directly in route > 'article' => 'CfArticle\Controller\ControllerFactory', // Does > only work for last module loaded > ), > ), > ); > > module.config.php for CfFrontend (last one loaded: wins) > > return array( > > 'router' => array( > 'routes' => array( > 'cf-frontend' => array( > 'type' => 'Literal', > 'options' => array( > 'route' => '/', > 'defaults' => array( > 'controller' => 'frontend', // works > 'action' => 'index', > ), > ), > ), > ), > ), > > 'controller' => array( // works > 'factories' => array( // using invokables is not possible here, > only directly in route > 'frontend' => 'CfFrontend\Controller\ControllerFactory', > ), > 'invokables' => array( // does not work, not even if 'factories' > is gone, just here as an example > 'frontend' => 'CfFronted\Controller\FrontendController', > ), > ), > ); > > Anyone any ideas, are these bugs I should fix? > > -Bart > > > > -- > Bart McLeod > *Space Web* > Middenlaan 47 > 6869 VN Heveadorp > The Netherlands > *t* +31(0)26 3392952 > *m* 06 51 51 89 71 > *@* [email protected] > www.spaceweb.nl [image: zce PHP 4 logo] [image: zce PHP 5 logo] [image: > zce PHP 5.3 logo] [image: zce Zend Framework logo] > > *Bart McLeod is a Zend Certified Engineer.* > > Click to verify! <http://www.zend.com/zce.php?c=ZEND004591&r=218204904> >
