Dispatches an event to the event dispatcher, if one has been configured.

@param string $eventName The name of the event to dispatch
@param Event|null $event The (optional) event object
172150
public function dispatchEvent($eventName, Event $event = null)
    {
        if ($this->eventDispatcher instanceof EventDispatcherInterface) {
            $this->eventDispatcher->dispatch($eventName, $event);
        }
    }
185438
public function listen($eventName, $callback)
    {
        if (is_array($eventName)) {
            foreach ($eventName as $evnt) {
                $this["dispatcher"]->addListener($evnt, $callback);
            }
        } else {
            $this["dispatcher"]->addListener($eventName, $callback);
        }
    }
897940
protected function triggerMethod($eventName, Event $event)
    {
        $method = sprintf('on%s', Container::camelize(str_replace('.', '_', $eventName)));

        if(is_callable([$this, $method])) {
            call_user_func_array([$this, $method], [$event]);
        }

        if($event->isPropagationStopped()){
            return $event;
        }

        $this->getDispatcher()->dispatch($eventName, $event);

        return $event;
    }
521539
public function dispatch($eventName, $params)
    {
        $event = new DedicatedEvent();
        $event->setParameters($params);
        $this->symfonyEventDispatcher->dispatch("maniaplanet.game.".$eventName, $event);
    }
427422
protected function dispatchEvent(string $eventName): self
    {
        $dispatcher = $this->getEventDispatcher();
        if (!is_null($dispatcher)) {
            $time = !is_null($this->startTime) ? microtime(true) - $this->startTime : 0;

            $event = new DaemonEvent($this);
            $event->setExecutionTime($time);

            $dispatcher->dispatch($eventName, $event);
        }

        return $this;
    }
860463
protected function dispatchDataTablesEvent($eventName, array $entities) {

        $eventDispatcher = $this->getEventDispatcher();
        if (null !== $eventDispatcher && false === $eventDispatcher->hasListeners($eventName)) {
            return null;
        }

        $this->getLogger()->debug(sprintf("DataTables controller dispatch an event with name \"%s\"", $eventName));

        return $eventDispatcher->dispatch($eventName, new DataTablesEvent($eventName, $entities));
    }
1340925
public function dispatch(Event $event) {

		$this->lastEvent = $event;
		$eventName = $event->getName();

		if (isset($this->registry[$eventName])) {

			foreach ($this->getSortedRegistry($eventName) as $listener) {
				call_user_func($listener, $event);
			}
			
		}

	}
1114563
public function dispatch($event/*, string $eventName = null*/)
    {
        $eventName = 1 < \func_num_args() ? \func_get_arg(1) : null;

        if (\is_object($event)) {
            $eventName = $eventName ?? \get_class($event);
        } else {
            @trigger_error(sprintf('Calling the "%s::dispatch()" method with the event name as first argument is deprecated since Symfony 4.3, pass it second and provide the event object first instead.', EventDispatcherInterface::class), E_USER_DEPRECATED);
            $swap = $event;
            $event = $eventName ?? new Event();
            $eventName = $swap;

            if (!$event instanceof Event) {
                throw new \TypeError(sprintf('Argument 1 passed to "%s::dispatch()" must be an instance of %s, %s given.', EventDispatcherInterface::class, Event::class, \is_object($event) ? \get_class($event) : \gettype($event)));
            }
        }

        if (null !== $this->optimized && null !== $eventName) {
            $listeners = $this->optimized[$eventName] ?? (empty($this->listeners[$eventName]) ? [] : $this->optimizeListeners($eventName));
        } else {
            $listeners = $this->getListeners($eventName);
        }

        if ($listeners) {
            $this->callListeners($listeners, $eventName, $event);
        }

        return $event;
    }
397885
protected function getEventLogInfo(Event $event, $eventName)
    {
        if ($event instanceof EmbeddedEventResolverInterface) {
            return $event->getEventLogInfo($eventName);
        }

        if (null === $eventResolver = $this->getResolver($eventName)) {
            return null;
        }

        return $eventResolver->getEventLogInfo($event, $eventName);
    }
544095
public function dispatch($eventName, sfEvent $event = null)
    {
        if (null !== $this->application) {
            $this->application->debug(sprintf('Dispatching `%s` event.', $eventName));
        }

        return parent::dispatch($eventName, $event);
    }
984746
public function dispatch($eventName, Eresus_Event $event = null)
    {
        if (!array_key_exists($eventName, $this->listeners))
        {
            return;
        }

        if (null === $event)
        {
            $event = new Eresus_Event();
        }

        $event->setName($eventName);

        krsort($this->listeners[$eventName]);

        foreach ($this->listeners[$eventName] as $listeners)
        {
            foreach ($listeners as $listener)
            {
                call_user_func($listener, $event);
                if ($event->isPropagationStopped())
                {
                    break 2;
                }
            }
        }
    }
1085170
protected function lazyLoad($eventName)
    {
        parent::lazyLoad($eventName);

        if (isset($this->listenerIds[$eventName])) {
            foreach ($this->listenerIds[$eventName] as $args) {
                list($serviceId, $method, $priority, $queueName) = $args;
                if ($queueName != null) {
                    $listener = $this->container->get($serviceId);
                    $key = $serviceId.'.'.$method;
                    $this->listeners[$eventName][$key] = array($listener, $queueName);
                }
            }
        }
    }
1087492
protected function call($eventName, $method, $data = null)
    {
        if (method_exists($this, $method)) {
            $result = call_user_func_array([$this, $method], $data);
            return $result;
        }

        return null;
    }
434527
public function dispatchEvent($event, ...$arguments)
    {
        $this->dispatchEventToEventCallbacks($event, $arguments);

        $this->dispatchEventToEventHandler($event, $arguments);
    }
778460
public function dispatch($eventName, Event $event = null)
    {
        if (null == $event) {
            $event = new Event($eventName);
        }

        return $this->doDispatch($event);
    }
1366364
public function dispatch($event_name, Event $event)
    {
        $dir = $this->events_dir.$event_name.'/';

        if (!file_exists($dir)) {
            mkdir($dir, 0755, true);
        }

        $event = serialize($event);
        file_put_contents($dir.md5($event).'.meta', $event);
    }
1362205
protected function dispatch($eventName, ActionEvent $event = null)
    {
        if ($event == null) {
            $event = new DefaultActionEvent();
        }

        $this->getDispatcher()->dispatch($eventName, $event);
    }