On Mon, Dec 30, 2013 at 3:37 PM, dennis-fedco <dmatve...@fedco-usa.com> wrote:
> When generating controller configuration, Zend Studio 10.5 by default creates
> something like this:
>
>     'controllers' => array(
>         'invokables' => array(
>             'Module\Controller\Index' =>
> 'Module\Controller\IndexController',
>         ),
>     ),
>
> and
>
>   'defaults' => array(
>          '__NAMESPACE__' => 'Module\Controller',
>         'controller'    => 'Index',
>         'action'        => 'index',
>     ),
>
> In one of the labs I was following, instead, this is suggested:
>
>     'controllers' => array(
>         'invokables' => array(
>             'module-index-controller' =>
> 'Module\Controller\IndexController',
>         ),
>     ),
>
> and
>
>     'defaults' => array(
>         'controller'    => 'module-index-controller',
>         'action'=>'index',
>     ),
>
> May I have the word of the wise on which method is more suggested?

I prefer the first, though I typically omit the "__NAMESPACE__" key
and just include the namespace in the controller:

    'controller' => 'Module\Controller\Index'

The reason is that I prefer the keys to be class names (or interfaces,
or abstract classes) whenever possible (or reasonably close), as it
makes it more clear to the consumer what they are trying to retrieve,
and what they will be consuming.


-- 
Matthew Weier O'Phinney
Project Lead            | matt...@zend.com
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com


Reply via email to