0

\Foo\BarRouteルート インターフェイス ( )を実装するクラスがあります\Zend\Mvc\Router\RouteInterface

\Foo\BarRouteルート プラグインとして追加し、bar構成で使用できるようにするにはどうすればよいですか (例'type' => 'bar')?

これまでのところ、次の Module.php を何の効果もなく取得しました:(

public function onBootstrap(EventInterface $e)
{
    $routePluginManager = $e->getRouter()->getRoutePluginManager();
    $routePluginManager->setInvokableClass('bar', '\Foo\BarRoute');
}

これは、モジュール構成ファイルのみで実行できますか?

ありがとう!

4

1 に答える 1

0

Why not set the FQCN of your custom route class in the module.config.php directly? in case you just need to use it in your module config file.

e.g.

return array(
    'router' => array(
        'routes' => array(

            'home' => array(
                'type'    => 'Foo\BarRoute',
                'options' => array(
                    'route'    => '/',
                    'defaults' => array(),
            ),),
    ),),

    ...

);
于 2013-02-19T17:24:37.063 に答える