Calling all Symfony Coders: New-B's EventDispatcher quietly fails
/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.
精彩评论