tormjens/eventy

When 2 or more actions have the same priority, just one registered

midoalone opened this issue · 5 comments

When I tried to register more than one action with the same priority, just on of them "The last one" is registered and override the others.

Sorry for the late response. I'll have a look at it ASAP!

Was this ever fixed?

unfortunately this bug has not beed fixed yet

I have fixed this issue with some tricks by changing listen function
file Event.php
public function listen($hook, $callback, $priority = 20, $arguments = 1) { $i = 0; $uniquePriority = $priority; do { if( isset( $this->listeners[$uniquePriority][$hook] ) ) { $i += 0.1; $uniquePriority = $priority + $i; } } while( isset( $this->listeners[$uniquePriority][$hook] ) ); $this->listeners[$uniquePriority][$hook] = compact('callback', 'arguments'); }

Great stuff! Thanks.