public function dispatchEvent(DatabaseEvent
$event, ?string
$eventName = NULL
): DatabaseEvent
{ if (\Drupal::
hasService('event_dispatcher'
)) { return \Drupal::
service('event_dispatcher'
)->
dispatch($event,
$eventName);
} throw new EventException('The event dispatcher service is not available. Database API events can only be fired if the container is initialized'
);
} /**
* Determine the last non-database method that called the database API.
*
* Traversing the call stack from the very first call made during the
* request, we define "the routine that called this query" as the last entry
* in the call stack that is not any method called from the namespace of the
* database driver, is not inside the Drupal\Core\Database namespace and does
* have a file (which excludes call_user_func_array(), anonymous functions
* and similar). That makes the climbing logic very simple, and handles the
* variable stack depth caused by the query builders.
*
* See the @link http://php.net/debug_backtrace debug_backtrace() @endlink
* function.
*
* @return array
* This method returns a stack trace entry similar to that generated by
* debug_backtrace(). However, it flattens the trace entry and the trace
* entry before it so that we get the function and args of the function that
* called into the database system, not the function and args of the
* database call itself.
*/