當前位置: 首頁>>代碼示例>>PHP>>正文


PHP EventDispatcher\GenericEvent類代碼示例

本文整理匯總了PHP中Symfony\Component\EventDispatcher\GenericEvent的典型用法代碼示例。如果您正苦於以下問題:PHP GenericEvent類的具體用法?PHP GenericEvent怎麽用?PHP GenericEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了GenericEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: onUpdate

 public function onUpdate(GenericEvent $event)
 {
     $entity = $event->getSubject();
     if ($entity instanceof Routeable && $entity->getRoute() != null) {
         $this->updateRoute($entity->getRoute());
     }
 }
開發者ID:npakai,項目名稱:enhavo,代碼行數:7,代碼來源:DoctrineRouteableSubscriber.php

示例2:

 function it_send_password_reset_pin_mail($sender, GenericEvent $event, UserInterface $user)
 {
     $event->getSubject()->willReturn($user);
     $user->getEmail()->willReturn('test@example.com');
     $sender->send('reset_password_pin', ['test@example.com'], Argument::any())->shouldBeCalled();
     $this->sendResetPasswordPinEmail($event);
 }
開發者ID:gabiudrescu,項目名稱:Sylius,代碼行數:7,代碼來源:MailerListenerSpec.php

示例3:

 function it_resolves_order_states(StateResolverInterface $stateResolver, GenericEvent $event, OrderInterface $order)
 {
     $event->getSubject()->willReturn($order);
     $stateResolver->resolveShippingState($order)->shouldBeCalled();
     $stateResolver->resolvePaymentState($order)->shouldBeCalled();
     $this->resolveOrderStates($event);
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:7,代碼來源:OrderStateListenerSpec.php

示例4:

 function it_does_not_proceed_order_channel_if_it_is_already_set(GenericEvent $event, OrderInterface $order, ChannelInterface $channel)
 {
     $event->getSubject()->willReturn($order);
     $order->getChannel()->willReturn($channel);
     $order->setChannel($channel)->shouldNotBeCalled();
     $this->processOrderChannel($event);
 }
開發者ID:okwinza,項目名稱:Sylius,代碼行數:7,代碼來源:OrderChannelListenerSpec.php

示例5:

 function it_proccess_order_channel_successfully(GenericEvent $event, OrderInterface $order, ChannelContextInterface $channelContext, ChannelInterface $channel)
 {
     $event->getSubject()->shouldBeCalled()->willReturn($order);
     $channelContext->getChannel()->shouldBeCalled()->willReturn($channel);
     $order->setChannel($channel)->shouldBeCalled();
     $this->processOrderChannel($event);
 }
開發者ID:Silwereth,項目名稱:Sylius,代碼行數:7,代碼來源:OrderChannelListenerSpec.php

示例6: onCheckoutComplete

 /**
  * {@inheritdoc}
  */
 public function onCheckoutComplete(GenericEvent $event)
 {
     /** @var OrderInterface $order */
     $order = $event->getSubject();
     Assert::isInstanceOf($order, OrderInterface::class);
     $this->session->set('sylius_order_id', $order->getId());
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:10,代碼來源:CheckoutCompleteListener.php

示例7: updateChannel

 /**
  * @param GenericEvent $event
  */
 public function updateChannel(GenericEvent $event)
 {
     $channel = $event->getSubject();
     if (!$channel instanceof ChannelInterface) {
         return;
     }
     $oldLocales = $this->repository->getDeletedLocalesForChannel($channel);
     $newLocales = $channel->getLocales();
     $updatedLocales = [];
     foreach ($oldLocales as $locale) {
         $locale->removeChannel($channel);
         $updatedLocales[] = $locale;
         if (null !== $this->completeness) {
             $this->completeness->scheduleForChannelAndLocale($channel, $locale);
         }
     }
     foreach ($newLocales as $locale) {
         if (!$locale->hasChannel($channel)) {
             $locale->addChannel($channel);
             $updatedLocales[] = $locale;
         }
     }
     if (!empty($updatedLocales)) {
         $this->saver->saveAll($updatedLocales);
     }
 }
開發者ID:aml-bendall,項目名稱:ExpandAkeneoApi,代碼行數:29,代碼來源:ChannelLocaleSubscriber.php

示例8: login

 public function login(GenericEvent $event)
 {
     $user = $event->getSubject();
     if ($user instanceof UserInterface) {
         $this->userCartMerger->merge($user);
     }
 }
開發者ID:enhavo,項目名稱:enhavo,代碼行數:7,代碼來源:UserSubscriber.php

示例9: up

 /**
  * Starts a new phantomjs process in background
  *
  * @throws \Symfony\Component\Process\Exception\RuntimeException
  */
 public function up()
 {
     $this->killAllRunning();
     $this->process = new Process('phantomjs --webdriver=' . $this->port . ' ' . $this->options);
     $process = $this->process;
     $output = new GenericEvent();
     $process->setTimeout(null);
     $process->start(function () use($process, $output) {
         $output->setArgument('output', $process->getIncrementalOutput());
     });
     $phantomjsOnline = false;
     $portScan = false;
     while (!$phantomjsOnline) {
         if ($output->hasArgument('output')) {
             $portScan = strpos($output->getArgument('output'), 'running on port ' . $this->port);
         }
         if ($portScan) {
             echo $output->getArgument('output');
         }
         $phantomjsOnline = $process->isStarted() && $process->isRunning() && $portScan;
         if ($process->isTerminated()) {
             throw new RuntimeException('Phantomjs could not been started with webdriver on port ' . $this->port);
         }
     }
 }
開發者ID:mazelab,項目名稱:phantomjsstarter,代碼行數:30,代碼來源:Starter.php

示例10:

 function it_does_not_update_password_if_customer_does_not_have_user(PasswordUpdaterInterface $passwordUpdater, GenericEvent $event, CustomerInterface $customer)
 {
     $event->getSubject()->willReturn($customer);
     $customer->getUser()->willReturn(null);
     $passwordUpdater->updatePassword(null)->shouldNotBeCalled();
     $this->customerUpdateEvent($event);
 }
開發者ID:TeamNovatek,項目名稱:Sylius,代碼行數:7,代碼來源:PasswordUpdaterListenerSpec.php

示例11:

 function it_does_not_set_locale_on_post_update_when_event_subject_is_different_from_current_user($translator, GenericEvent $event, UserInterface $user, RequestStack $requestStack, Request $request, LocaleInterface $locale)
 {
     $event->getSubject()->willReturn($user);
     $event->getArgument('current_user')->willReturn(null);
     $translator->setLocale('fr_FR')->shouldNotBeCalled();
     $this->onPostUpdate($event);
 }
開發者ID:a2xchip,項目名稱:pim-community-dev,代碼行數:7,代碼來源:LocaleSubscriberSpec.php

示例12: checkChannels

 /**
  * Check if channels are linked to this tree
  *
  * @param GenericEvent $event
  *
  * @throws ConflictHttpException
  */
 public function checkChannels(GenericEvent $event)
 {
     $tree = $event->getSubject();
     if (count($tree->getChannels()) > 0) {
         throw new ConflictHttpException($this->translator->trans('flash.tree.not removable'));
     }
 }
開發者ID:javiersantos,項目名稱:pim-community-dev,代碼行數:14,代碼來源:CheckChannelsOnDeletionSubscriber.php

示例13: onApiCall

 /**
  * @param GenericEvent $event
  */
 public function onApiCall(GenericEvent $event)
 {
     if (!$this->calls) {
         $this->calls = [];
     }
     $this->calls[] = $event->getSubject();
 }
開發者ID:phppro,項目名稱:sdk,代碼行數:10,代碼來源:DataCollector.php

示例14: onTextmasterDocumentIncomplete

 /**
  * Mark document's related job as 'started'.
  *
  * @param GenericEvent $event
  */
 public function onTextmasterDocumentIncomplete(GenericEvent $event)
 {
     /** @var DocumentInterface $document */
     $document = $event->getSubject();
     $job = $this->jobManager->getFromDocument($document);
     $this->jobManager->start($job);
 }
開發者ID:worldia,項目名稱:textmaster-bundle,代碼行數:12,代碼來源:DocumentListener.php

示例15: initializeRequest

 public function initializeRequest(GenericEvent $event)
 {
     if (null === $this->request) {
         return;
     }
     $this->request->attributes->set('easyadmin', array('entity' => $entity = $event->getArgument('entity'), 'view' => $this->request->query->get('action', 'list'), 'item' => ($id = $this->request->query->get('id')) ? $this->findCurrentItem($entity, $id) : null));
 }
開發者ID:artggd,項目名稱:EasyAdminBundle,代碼行數:7,代碼來源:RequestPostInitializeListener.php


注:本文中的Symfony\Component\EventDispatcher\GenericEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。