Issues with Event_Dispatcher
| From: | Dan Rossi | Date: | Wed, 13 Apr 2005 04:25:39 +0000 |
| Subject: | Issues with Event_Dispatcher | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-18713@lists.php.net to get a copy of this message | ||
Firstly a very nice package, very similar to how flash handles events. I am having issues using dispatcher which is used in LiveUser, I have googled and noticed PEAR::Exception is also using it :)
Ok first things first the example on the pear site is wrong, its referencing a getUserName method which doesnt exist :) It only gives an example on how to reference ONE event with a function. What I am trying to achieve is one class which handles all event notifications. This however is not happening, if i set a call to an addObserver i must give it the object + one event notification, this works it will execute a method of the same name but setting up a call two two events wont work unless i setup two different observers, unfortunately however this executes both methods at once !
example
class Login
{
function onLogin()
{
}
function onLogout()
{
}
}
$login = new Login;
$LU->dispatcher->addObserver(array($login,'onLogin'));
onLogout wont happen until i add another one
$LU->dispatcher->addObserver(array($login,'onLogout'));
but then both are executing even when there is no onLogout notification !
Let me know.