开发者

Calling all Symfony Coders: New-B's EventDispatcher quietly fails

I'm pretty stuck here. I'm trying to include an EventDispatcher in an Ajax Action but it just quietly fails. I'm pretty new to symfony and am currently working on customizations of the "VImp" CMS (http://vimp.com/) which is based on symfony 1.1.6.

In /apps/xx/modules/xx/actions/base/BaseXxActions.php there's this:

public function executeAjax {  
    switch($this->getVar('action')) {  
        case 'something':  
            sfContext::getInstance()->getEventDispatcher()->notify(
              new sfEvent(
                $this,
                'activity',
                array(
                  'action' => 'user.something.save',
                  'user' => sfContext::getInstance()->getUser()->getUser(),
                  'something'=>$something
                )
              开发者_开发技巧)
            );  
        break;    
    }  
}

Now this just quietly does nothing. Nothing in the server or the symfony logs. I pretty much just copy/pasted the line from a couple of lines earlier and it doesnT seem to matter which parameters I use.

Can someone help me here? Where and how do I get specific info on why this fails?

Thanks,

thomas

(I also can't get syntax highlighting to work ...)


In case someone ever faces the same problem ... I finally found my solution:

class frontendConfiguration extends sfApplicationConfiguration 
{  
    public function configure()  
    {  
       // Register our listener  
       $this->dispatcher->connect('user.something.save', array('myClass', 'itsMethod'));
    }  
}

This tells the event dispatcher what to do in case the event is fired.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜