1
0
mirror of synced 2024-12-13 06:46:03 +03:00

Cosmetics changes in EventManager, renamed the registerEventListener to addEventListener, optimized the source and changed the arguments order. Commented an echo line in RangeVariableDeclaration

This commit is contained in:
guilhermeblanco 2008-06-08 16:42:55 +00:00
parent ad2443057e
commit 24ca13980f
2 changed files with 16 additions and 12 deletions

View File

@ -6,6 +6,7 @@ class Doctrine_EventManager
{
private $_listeners = array();
public function dispatchEvent($event) {
$argIsCallback = is_string($event);
$callback = $argIsCallback ? $event : $event->getType();
@ -20,22 +21,25 @@ class Doctrine_EventManager
return ! $event->getDefaultPrevented();
}
public function getListeners($callback = null) {
return $callback ? $this->_listeners[$callback] : $this->_listeners;
}
public function hasListeners($callback) {
return isset($this->_listeners[$callback]);
}
public function registerEventListener($listener, $callbacks) {
public function addEventListener($callbacks, $listener) {
// TODO: maybe check for duplicate registrations?
if (is_array($callbacks)) {
foreach ($callbacks as $callback) {
$this->_listeners[$callback] = $listener;
}
} else {
$this->_listeners[$callbacks] = $listener;
if ( ! is_array($callbacks)) {
$callbacks = array($callbacks);
}
foreach ($callbacks as $callback) {
$this->_listeners[$callback] = $listener;
}
}
}

View File

@ -216,7 +216,7 @@ class Doctrine_Query_Production_RangeVariableDeclaration extends Doctrine_Query_
$parent = $path;
} catch (Doctrine_Exception $e) {
echo "Tried to load class metadata from '".$relationName."'\n";
//echo "Tried to load class metadata from '".$relationName."'\n";
$this->_parser->semanticalError($e->getMessage());
return;