Dispatch event

@param \Doctrine\ORM\EntityManager $em    Entity manager
@param string                      $event Event name
347354
private function dispatchEvent($em, $event)
    {
        $eventArgs = new LifecycleEventArgs(null, $em);

        $em->getEventManager()
           ->dispatchEvent($event, $eventArgs);
    }
319135
public function handle(ManagerRegistry $registry)
    {
        $names = $this->option('em') ? [$this->option('em')] : $registry->getManagerNames();

        foreach ($names as $name) {
            $em = $registry->getManager($name);

            $this->comment('');
            $this->message('Generating getter and setter for <info>' . $name . '</info> entity manager...', 'blue');

            $cmf = new DisconnectedClassMetadataFactory();
            $cmf->setEntityManager($em);
            $metadatas = $cmf->getAllMetadata();
            $metadatas = MetadataFilter::filter($metadatas, $this->option('filter'));

            $destPath = base_path($this->argument('dest-path') ?:'app/Entities');

            if (!is_dir($destPath)) {
                mkdir($destPath, 0777, true);
            }

            $destPath = realpath($destPath);

            if (!file_exists($destPath)) {
                throw new \InvalidArgumentException(
                    sprintf("Proxies destination directory ' < info>%s </info > ' does not exist.",
                        $em->getConfiguration()->getProxyDir())
                );
            }

            if (count($metadatas)) {

                // Create EntityGenerator
                $entityGenerator = new EntityGenerator();

                $entityGenerator->setGenerateAnnotations($this->option('generate-annotations'));
                $entityGenerator->setGenerateStubMethods($this->option('generate-methods'));
                $entityGenerator->setRegenerateEntityIfExists($this->option('regenerate-entities'));
                $entityGenerator->setUpdateEntityIfExists($this->option('update-entities'));
                $entityGenerator->setNumSpaces($this->option('num-spaces'));
                $entityGenerator->setBackupExisting(!$this->option('no-backup'));

                if (($extend = $this->option('extend')) !== null) {
                    $entityGenerator->setClassToExtend($extend);
                }

                foreach ($metadatas as $metadata) {
                    $this->comment(
                        sprintf('Processing entity "<info>%s</info>"', $metadata->name)
                    );
                }

                // Generating Entities
                $entityGenerator->generate($metadatas, $destPath);

                // Outputting information message
                $this->comment(PHP_EOL . sprintf('Entity classes generated to "<info>%s</INFO>"', $destPath));
            }
        }
    }
1214871
public function onEvent(Event $event = null)
    {
        while (!empty($this->messages)) {
            $message = array_shift($this->messages);

            $this->handle($message, $this->dispatcher);
        }
    }
352113
protected function propagateEntityChangedEvent(EntityChangedEvent $event)
    {
        foreach ($this->listeners as $listener) {
            $listener->onEntityChanged($event);
        }
    }
761521
protected function dispatchEvent($event)
    {
        if (!$this->container) {
            throw new \RuntimeException("The container has not been set up.");
        }
        $dir = $this->container->getParameter('base_dir');
        if (!is_dir($dir) || !is_readable($dir)) {
            throw new \RuntimeException("'${dir}' is not a valid readable directory.");
        }
        $dispatcher = $this->container->get('event_dispatcher');
        $dispatcher->dispatch($event);
    }
987970
public function fireEvent($event, $entity, $halt = true)
    {
        /*if ($entity instanceof Wrapper) {
            throw new InvalidArgumentException('Fired Event with invalid Entity Object');
        }*/

        $eventName = "analogue.{$event}.".$this->entityMap->getClass();

        $method = $halt ? 'until' : 'fire';

        if (!array_key_exists($event, $this->events)) {
            throw new \LogicException("Analogue : Event $event doesn't exist");
        }

        $eventClass = $this->events[$event];
        $event = new $eventClass($entity);

        return $this->dispatcher->$method($eventName, $event);
    }
857846
protected function dispatch($name, Event $event)
    {
        $this->assertEventName($name);
        $this->getEventDispatcher()->dispatch($name, $event);
        return $this;
    }
714895
public function addEntityManager(EntityManagerInterface $em)
    {
        if (!in_array($em, $this->entityManagers, true)) {
            $this->entityManagers[] = $em;
        }

        return $this;
    }
7547
public function setEventManager(EventManagerInterface $events) {
	    parent::setEventManager($events);
		$controller = $this;
		$events->attach('dispatch', function ($e) use ($controller) {
			$controller->layout('layout/cathedral/builder');
		}, 100);
	}
329020
public void dispatch(Event<?> event) {
		//eventManagement.dispatch(event);
		for (EventListener listener : KReflection.Holder.INSTANCE.listeners) {
			try {
				listener.handleEvent(event);
			} catch (Exception e) {
				// ignore
				// TODO add message kind
			}
		}
	}
32973
public function dispatchEvent(\Symfony\Component\EventDispatcher\Event $event)
    {
        $container = \OxidEsales\EshopCommunity\Internal\Application\ContainerFactory::getInstance()->getContainer();
        $dispatcher = $container->get(EventDispatcherInterface::class);
        return $dispatcher->dispatch($event::NAME, $event);
    }
726763
protected function dispatch($event) {
        if (empty($event['type'])) {
            $this->logger->warning('wrong event type, maybe something wrong');

            return false;
        }

        if (strpos($event['type'], ':') === false) {
            $event['type'] .= ':handleEvent';
        }

        try {
            $this->eventsManager->fire($event['type'], $this, $event['data']);
        } catch (\Exception $e) {
            $this->logger->warning('dispatch event exception while subscribing event queue', ['code' => $e->getCode(), 'msg' => $e->getMessage(), 'trace' => $e->getTrace()]);
        } finally {
            $this->mq->confirm($event, Queue::CONFIRM_SUCC);
        }

        return true;
    }
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);
			}
			
		}

	}
561131
public function dispatch($data) 
    {

        $event = new \Moxy\Event($this->_name, $data);

        foreach($this->_listeners as $listener) {
            $listener->call($event);
        }

    }
1035220
public function dispatchEvent($name, SearchEvent $event, array $context = array())
    {
        $log = $this->getLogger();
        $context['event'] = $name;
        $log->debug('Throwing event', $context);
        $this->getDispatcher()->dispatch($name, $event);
        $log->debug('Event thrown', $context);
    }
1232975
public function setEntityManager(EntityManager $em)
    {
        if ($this->em !== null) {
            throw new \LogicException('Entity manager can only be set before any results are fetched');
        }

        $this->em = $em;
    }
206042
public function sendGetCalendarEventsToApp(Event $event, EntityInterface $calendar, array $options = []): void
    {
        $eventName = preg_replace('/^(Plugin)/', 'App', $event->getName());
        if (empty($eventName)) {
            return;
        }

        $ev = new Event($eventName, $this, [
            'calendar' => $calendar,
            'options' => $options
        ]);

        EventManager::instance()->dispatch($ev);

        $event->result = $ev->result;
    }