Skip to content

Commit

Permalink
changed priority meaning to be more intuitive
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jan 14, 2011
1 parent e41df3d commit b47cf79
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
Expand Up @@ -154,7 +154,7 @@
</service>

<service id="security.firewall" class="%security.firewall.class%" public="false">
<tag name="kernel.listener" priority="128" />
<tag name="kernel.listener" priority="-128" />
<argument type="service" id="security.firewall.map" />
</service>
<service id="security.firewall.map" class="%security.firewall.map.class%" public="false" />
Expand Down
Expand Up @@ -46,7 +46,7 @@
</service>

<service id="exception_listener" class="%exception_listener.class%" public="false">
<tag name="kernel.listener" priority="128" />
<tag name="kernel.listener" priority="-128" />
<argument>%exception_listener.controller%</argument>
<argument type="service" id="logger" on-invalid="null" />
</service>
Expand Down
Expand Up @@ -11,7 +11,7 @@

<services>
<service id="debug.toolbar" class="%debug.toolbar.class%" public="false">
<tag name="kernel.listener" priority="128" />
<tag name="kernel.listener" priority="-128" />
<argument type="service" id="controller_resolver" />
<argument>%debug.toolbar.intercept_redirects%</argument>
</service>
Expand Down
4 changes: 3 additions & 1 deletion src/Symfony/Component/EventDispatcher/EventDispatcher.php
Expand Up @@ -24,6 +24,8 @@ class EventDispatcher
/**
* Connects a listener to a given event name.
*
* Listeners with a higher priority are executed first.
*
* @param string $name An event name
* @param mixed $listener A PHP callable
* @param integer $priority The priority (between -10 and 10 -- defaults to 0)
Expand Down Expand Up @@ -148,7 +150,7 @@ public function getListeners($name)

$listeners = array();
$all = $this->listeners[$name];
ksort($all);
krsort($all);
foreach ($all as $l) {
$listeners = array_merge($listeners, $l);
}
Expand Down

0 comments on commit b47cf79

Please sign in to comment.