Pass an instance of Request Processor to *_FUNCTION_CALL events

This commit is contained in:
Dmitriy Simushev 2015-01-22 11:41:35 +00:00
parent 6d3810b7ba
commit f015b5b820
2 changed files with 14 additions and 2 deletions

View File

@ -321,6 +321,9 @@ final class Events
*
* An associative array with the following items is passed to the event
* handlers:
* - "request_processor": an instance of
* {\Mibew\RequestProcessor\ThreadProcessor} which processes the current
* call.
* - "function": string, name of the function that was called.
* - "arguments": associative array of arguments that was passed to the
* function.
@ -465,6 +468,9 @@ final class Events
*
* An associative array with the following items is passed to the event
* handlers:
* - "request_processor": an instance of
* {\Mibew\RequestProcessor\UsersProcessor} which processes the current
* call.
* - "function": string, name of the function that was called.
* - "arguments": associative array of arguments that was passed to the
* function.

View File

@ -76,8 +76,13 @@ use Symfony\Component\HttpFoundation\Response;
*
* 5. "<eventPrefix>FunctionCall" - triggers when function from request calls.
*
* An associative array passed to event handler is 'function' array. See Mibew
* API for detail of the 'function' array structure.
* An associative array passed to event handler contains the following items:
* - "request_processor": an instance of a subclass of
* {\Mibew\RequestProcessor\AbstractProcessor} which processes the current
* call.
* - "function": string, name of the function that was called.
* - "arguments": array, arguments that was passed to the function.
* - "results": array, results of the function execution.
*
* If function wants to return some results, it should add results to the
* 'results' element of the function array.
@ -449,6 +454,7 @@ abstract class AbstractProcessor
$this->processorCall($call_vars);
// Trigger FunctionCall event
$call_vars['request_processor'] = $this;
$dispatcher = EventDispatcher::getInstance();
$dispatcher->triggerEvent($this->eventPrefix . 'FunctionCall', $call_vars);