Pre/Post event methods #20
Labels
No labels
bug
confirmed
critical
discussion
documentation
Doing
enhancement
suggestion
support
To Do
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: hazaar/hazaar-warlock#20
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A situation has arisen where I would like to chain some events together because they get triggered at the same time, however one relies on the other to set some data first. I can change my trigger method in the application, however I would like to support a specific trigger format (specific to the application) that allows events to get triggered in a chain.
The solution I have come up with is a pre/post event methods. Basically I would like to have generic
Service::beforeEvent($raw_packet)
andService::afterEvent($raw_packet)
methods that get executed before and after EVERY event method. This was I can have a single method that can inspect the trigger payload to see if needs to do other things before or after an event. This should allow me to chain my events, but I think this is a nice feature to have so that developers can execute common code regardless of the event being triggered at the time the event is received.I have also added the ability to return
FALSE
from these methods to abort further execution. Obviously except forafterEvent()
. So ifbeforeEvent()
returns false, the event method is not executed. If the event methods returns false, then theafterEvent()
method is not executed.Normally these methods don't return anything (ie: return null) so if a true/null/or anything else is returned, then execution will continue.
changed the description
assigned to @jamie
changed the description
changed the description
closed via commit
f11fbc1722