Erstellt die Abfrage für das Einfügen eines Fehlers in die Queue-Tabelle.
@param QueueSaveJobResultEvent  $event
@param                          $eventName
@param EventDispatcherInterface $dispatcher
322921
public function onSaveJobResultQuery(
        QueueSaveJobResultEvent $event,
        $eventName,
        EventDispatcherInterface $dispatcher
    ) {
        $table          = $event->getQueueTable();
        $field          = $event->getField();
        $data           = urlencode(serialize($event->getData()));
        $id             = $event->getId();
        $query          = "UPDATE $table SET $field = '$data' WHERE id = $id";
        $event->setQuery($query);
    }
941851
public function dispatch($event/*, string $eventName = null*/)
    {
        if (null === $this->callStack) {
            $this->callStack = new \SplObjectStorage();
        }

        $currentRequestHash = $this->currentRequestHash = $this->requestStack && ($request = $this->requestStack->getCurrentRequest()) ? spl_object_hash($request) : '';
        $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->logger && ($event instanceof Event || $event instanceof ContractsEvent || $event instanceof StoppableEventInterface) && $event->isPropagationStopped()) {
            $this->logger->debug(sprintf('The "%s" event is already stopped. No listeners have been called.', $eventName));
        }

        $this->preProcess($eventName);
        try {
            $this->beforeDispatch($eventName, $event);
            try {
                $e = $this->stopwatch->start($eventName, 'section');
                try {
                    $this->dispatcher->dispatch($event, $eventName);
                } finally {
                    if ($e->isStarted()) {
                        $e->stop();
                    }
                }
            } finally {
                $this->afterDispatch($eventName, $event);
            }
        } finally {
            $this->currentRequestHash = $currentRequestHash;
            $this->postProcess($eventName);
        }

        return $event;
    }
1313724
public function doDispatch(DispatchEvent $event)
    {
        $controller = $event->getContext();
        $action     = $event->getParam('action') . 'Action';

        $server   = $this->getServer();
        $request  = $server->getRequest()->withAddedAttributes($event->getParams());
        $response = $server->getResponse();

        $result = call_user_func_array([$controller, $action], [$request, $response]);
        $event->setResult($result);
    }
647763
public function onAddToQueueListenerLoadOldData(AddToQueueEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $table          = $event->getQueueTable();
        $srctable       = $event->getSrctable();
        $srcid          = $event->getSrcid();
        $query          = "INSERT INTO $table SET ";

        if ($srctable && $srcid) {
            $loadQuery  = "SELECT * FROM $table WHERE srctable = '$srctable' AND srcid = $srcid";
            $loadQuery .= " AND startworking = 0 AND endworking = 0";
            $loadResult = $this->database->execute($loadQuery);

            if ($loadResult->numRows) {
                $event->setOldData($loadResult);
            }
        }

        $event->setQuery($query);
    }
1031071
public function onSetErrorListenerQuery(
        QueueSetErrorEvent $event,
        $eventName,
        EventDispatcherInterface $dispatcher
    ) {
        $table          = $event->getQueueTable();
        $field          = $event->getField();
        $id             = $event->getId();
        $query          = "UPDATE $table SET $field = 1 WHERE id = $id";
        $event->setQuery($query);
    }
210805
public function onSubscriptionCreate(StripeSubscriptionCreateEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $localSubscription = $event->getLocalSubscription();

        $result = $this->getStripeManager()->createSubscription($localSubscription);

        // Check if something went wrong
        if (false === $result) {
            // Stop progation
            $event->setStopReason($this->getStripeManager()->getError())->stopPropagation();

            // Dispatch a failed event
            $dispatcher->dispatch(StripeSubscriptionCreateEvent::FAILED, $event);

            // exit
            return;
        }

        $dispatcher->dispatch(StripeSubscriptionCreateEvent::CREATED, $event);
    }
216250
public function afterOrder(OrderEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        /** @var CouponInterface[] $consumedCoupons */
        $consumedCoupons = $this->couponManager->getCouponsKept();

        if (\is_array($consumedCoupons) && \count($consumedCoupons) > 0) {
            $con = Propel::getWriteConnection(OrderCouponTableMap::DATABASE_NAME);
            $con->beginTransaction();

            try {
                foreach ($consumedCoupons as $couponCode) {
                    $couponQuery = CouponQuery::create();
                    $couponModel = $couponQuery->findOneByCode($couponCode->getCode());
                    $couponModel->setLocale($this->getSession()->getLang()->getLocale());

                    /* decrease coupon quantity */
                    $this->couponManager->decrementQuantity($couponModel, $event->getOrder()->getCustomerId());

                    /* memorize coupon */
                    $orderCoupon = new OrderCoupon();
                    $orderCoupon->setOrder($event->getOrder())
                        ->setCode($couponModel->getCode())
                        ->setType($couponModel->getType())
                        ->setAmount($couponCode->exec())

                        ->setTitle($couponModel->getTitle())
                        ->setShortDescription($couponModel->getShortDescription())
                        ->setDescription($couponModel->getDescription())

                        ->setStartDate($couponModel->getStartDate())
                        ->setExpirationDate($couponModel->getExpirationDate())
                        ->setIsCumulative($couponModel->getIsCumulative())
                        ->setIsRemovingPostage($couponModel->getIsRemovingPostage())
                        ->setIsAvailableOnSpecialOffers($couponModel->getIsAvailableOnSpecialOffers())
                        ->setSerializedConditions($couponModel->getSerializedConditions())
                        ->setPerCustomerUsageCount($couponModel->getPerCustomerUsageCount())
                    ;
                    $orderCoupon->save();

                    // Copy order coupon free shipping data for countries and modules
                    $couponCountries = CouponCountryQuery::create()->filterByCouponId($couponModel->getId())->find();

                    /** @var CouponCountry $couponCountry */
                    foreach ($couponCountries as $couponCountry) {
                        $occ = new OrderCouponCountry();

                        $occ
                            ->setCouponId($orderCoupon->getId())
                            ->setCountryId($couponCountry->getCountryId())
                            ->save();
                        ;
                    }

                    $couponModules = CouponModuleQuery::create()->filterByCouponId($couponModel->getId())->find();

                    /** @var CouponModule $couponModule */
                    foreach ($couponModules as $couponModule) {
                        $ocm = new OrderCouponModule();

                        $ocm
                            ->setCouponId($orderCoupon->getId())
                            ->setModuleId($couponModule->getModuleId())
                            ->save();
                        ;
                    }
                }

                $con->commit();
            } catch (\Exception  $ex) {
                $con->rollBack();

                throw($ex);
            }
        }

        // Clear all coupons.
        $dispatcher->dispatch(TheliaEvents::COUPON_CLEAR_ALL);
    }
545180
public function toggleVisibility(CountryToggleVisibilityEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $country = $event->getCountry();

        $country
            ->setDispatcher($dispatcher)
            ->setVisible(!$country->getVisible())
            ->save();

        $event->setCountry($country);
    }
155027
public function onSubscriptionCancel(StripeSubscriptionCancelEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $localSubscription = $event->getLocalSubscription();

        $localSubscription->setCancelAtPeriodEnd(true);

        $result = $this->getStripeManager()->cancelSubscription($localSubscription, true);

        // Check if something went wrong
        if (false === $result) {
            // Stop progation
            $event->setStopReason($this->getStripeManager()->getError())->stopPropagation();

            // Dispatch a failed event
            $dispatcher->dispatch(StripeSubscriptionCancelEvent::FAILED, $event);

            // exit
            return;
        }

        $dispatcher->dispatch(StripeSubscriptionCancelEvent::CANCELED, $event);
    }
1315792
public function bind(EventDispatcherInterface $dispatcher, $eventName)
    {
        if (isset($this->events[$eventName])) {
            return;
        }

        $dispatcher->addListener($eventName, $this->getListener(), $this->priority);
        $this->events[$eventName] = true;
    }
435394
public function dispatch($eventName, $data = null)
    {
        if (!interface_exists('Symfony\Component\EventDispatcher\EventDispatcherInterface')) {
            return;
        }

        if (null === $this->dispatcher) {
            return;
        }

        $event = new VcsEvent($data);

        $this->dispatcher->dispatch($eventName, $event);
    }
1092883
public function toggleVisibility(BrandToggleVisibilityEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $brand = $event->getBrand();

        $brand
            ->setDispatcher($dispatcher)
            ->setVisible(!$brand->getVisible())
            ->save();

        $event->setBrand($brand);
    }
938305
public function update(CouponCreateOrUpdateEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $coupon = $event->getCouponModel();

        $this->createOrUpdate($coupon, $event, $dispatcher);
    }
318770
public function fireEvent($eventName, Event $event = null)
    {
        /** @var EventDispatcher $events */
        $events = $this['events'];

        return $events->dispatch($eventName, $event);
    }
1293347
public function delete(CategoryDeleteEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        if (null !== $category = CategoryQuery::create()->findPk($event->getCategoryId())) {
            $con = Propel::getWriteConnection(CategoryTableMap::DATABASE_NAME);
            $con->beginTransaction();

            try {
                $fileList = ['images' => [], 'documentList' => []];

                // Get category's files to delete after category deletion
                $fileList['images']['list'] = CategoryImageQuery::create()
                    ->findByCategoryId($event->getCategoryId());
                $fileList['images']['type'] = TheliaEvents::IMAGE_DELETE;

                $fileList['documentList']['list'] = CategoryDocumentQuery::create()
                    ->findByCategoryId($event->getCategoryId());
                $fileList['documentList']['type'] = TheliaEvents::DOCUMENT_DELETE;

                // Delete category
                $category
                    ->setDispatcher($dispatcher)
                    ->delete($con);

                $event->setCategory($category);

                // Dispatch delete category's files event
                foreach ($fileList as $fileTypeList) {
                    foreach ($fileTypeList['list'] as $fileToDelete) {
                        $fileDeleteEvent = new FileDeleteEvent($fileToDelete);
                        $dispatcher->dispatch($fileTypeList['type'], $fileDeleteEvent);
                    }
                }

                $con->commit();
            } catch (\Exception $e) {
                $con->rollback();
                throw $e;
            }
        }
    }
172150
public function dispatchEvent($eventName, Event $event = null)
    {
        if ($this->eventDispatcher instanceof EventDispatcherInterface) {
            $this->eventDispatcher->dispatch($eventName, $event);
        }
    }
1143160
protected function fireEvent($eventName, Event $event)
    {
        if (!$this->eventDispatcher) {
            throw new \BadMethodCallException(sprintf(
                'Method %s() cannot be used while event dispatcher is not configured.',
                __METHOD__
            ));
        }

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