Symfony1 使用symfony 1.4定制布线

Symfony1 使用symfony 1.4定制布线,symfony1,symfony-1.4,Symfony1,Symfony 1.4,我想扩展symfony的默认路由器。我已经在lib/中创建了路由文件夹,并在lib/路由下创建了customRouter.class.php。我已将factories.yml更改如下: all: routing: class: customRouter Catchable fatal error: Argument 1 passed to sfRouting::__construct() must be an instance of sfEventDispatcher, strin

我想扩展symfony的默认路由器。我已经在lib/中创建了路由文件夹,并在lib/路由下创建了customRouter.class.php。我已将factories.yml更改如下:

all:
  routing:
    class: customRouter
Catchable fatal error: Argument 1 passed to sfRouting::__construct() must be an instance of sfEventDispatcher, string given in /opt/task/lib/vendor/symfony/lib/routing/sfRouting.class.php on line 32
我的customRouter.class.php是:

class customRouter extends sfPatternRouting{
}
我只扩展了这个类。当我运行应用程序时,会出现如下错误:

all:
  routing:
    class: customRouter
Catchable fatal error: Argument 1 passed to sfRouting::__construct() must be an instance of sfEventDispatcher, string given in /opt/task/lib/vendor/symfony/lib/routing/sfRouting.class.php on line 32

我没有意识到这个问题。我只延长课程。扩展symfony路由器的解决方案是什么?

我认为您扩展了错误的类,因此没有继承必要的方法。symfony 1.4文档建议扩展“sfDoctrineRoute”类以创建自定义路由,如symfony 1.4中的@Kenny

自定义路由在symfony手册的章节中所述。具体来说,关于的部分应该是有用的。@Kenny我已经检查了那篇文章,但它对我来说是无用的。因为我不使用教义。那篇文章是对sfDoctrineRoute的扩展。我必须扩展sfPatternRouting,但我不能。我正在使用symfony 1.4.11,我做了与您一样的事情:在lib中创建路由文件夹,清空customRouter类,在factories.yml中更改设置,清除缓存-没问题,也许你的问题与customRouter类本身无关?只需在构造函数中使用变量之前调试变量中的具体内容,我确信你必须跟踪问题的起点。