当前位置: 首页>>代码示例>>PHP>>正文


PHP EventInterface::getParams方法代码示例

本文整理汇总了PHP中Zend\EventManager\EventInterface::getParams方法的典型用法代码示例。如果您正苦于以下问题:PHP EventInterface::getParams方法的具体用法?PHP EventInterface::getParams怎么用?PHP EventInterface::getParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\EventManager\EventInterface的用法示例。


在下文中一共展示了EventInterface::getParams方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onIssueGetPost

 public function onIssueGetPost(EventInterface $e)
 {
     $this->log->debug('ISSUES_GET.post - store in cache');
     $config = $e->getParams();
     $key = 'issues-' . $config['account-name'] . '-' . $config['repo'] . '-' . implode('-', $config['issue-filters']);
     $this->cache->setItem($key, $config['issues']);
 }
开发者ID:av4tar,项目名称:sheti,代码行数:7,代码来源:IssueCacheListener.php

示例2: onBootstrap

 /**
  * {@inheritDoc}
  */
 public function onBootstrap(EventInterface $e)
 {
     $app = $e->getApplication();
     $sm = $app->getServiceManager();
     $config = $app->getConfig();
     // Set configuration options
     if ($phpSettings = $config['php_ini']) {
         foreach ($phpSettings as $key => $value) {
             ini_set($key, $value);
         }
     }
     $sharedEventManager = $sm->get('SharedEventManager');
     // Hook into comments
     $sharedEventManager->attach('theme', 'post.post', function ($e) use($sm) {
         $viewRenderer = $sm->get('ViewRenderer');
         return $viewRenderer->partial('socialog/comment/post', $e->getParams());
     });
     // Hook into comments
     $sharedEventManager->attach('view', 'navigation.render', function ($e) use($sm) {
         /* @var $pageMapper \Socialog\Mapper\PageMapper */
         $pageMapper = $sm->get('socialog_page_mapper');
         $result = "";
         foreach ($pageMapper->findAllPages() as $page) {
             $result .= new Theme\Menuitem($page->getTitle(), $e->getTarget()->url('socialog-page', array('id' => $page->getId())));
         }
         return $result;
     });
 }
开发者ID:socialog,项目名称:socialog,代码行数:31,代码来源:Module.php

示例3: log

 /**
  * Actually do the logging.
  *
  * @param EventInterface $event
  */
 public function log(EventInterface $event)
 {
     $params = $event->getParams();
     $method = '?';
     $exception = isset($params['exception']) ? $params['exception'] : '';
     $sql = isset($params['sql']) ? $params['sql'] : array();
     $this->logger->critical(get_class($event->getTarget()) . "::{$method} - {$exception}", $sql);
 }
开发者ID:bix0r,项目名称:Stjornvisi,代码行数:13,代码来源:ErrorEventListener.php

示例4: setKey

 private function setKey(EventInterface $e)
 {
     $params = $e->getParams();
     if (is_array($params) && array_key_exists('__RESULT__', $params)) {
         $this->_cache_result = $params['__RESULT__'];
         unset($params['__RESULT__']);
     }
     $this->_key = crc32(get_class($e->getTarget()) . '-' . json_encode($params));
 }
开发者ID:im286er,项目名称:ent,代码行数:9,代码来源:ListenerAggregate.php

示例5: removeFromCache

 /**
  * Remove the object from the Identity Map if it's there
  *
  * @param  EventInterface $e
  * @return void
  */
 public function removeFromCache(EventInterface $e)
 {
     $mapper = $e->getTarget();
     $params = $e->getParams();
     $query = $params['query'];
     $cacheKey = $query->getCacheKey();
     if (!$cacheKey) {
         return;
     }
     $this->identityMap->remove($mapper->getClassName(), $cacheKey);
 }
开发者ID:zealproject,项目名称:zeal-orm,代码行数:17,代码来源:IdentityMapListener.php

示例6: index

 /**
  * Send a message to Queue about indexing entry.
  *
  * @param EventInterface $event
  */
 public function index(EventInterface $event)
 {
     try {
         $connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
         $channel = $connection->channel();
         $channel->queue_declare('search-index', false, false, false, false);
         $params = $event->getParams();
         $msg = new AMQPMessage(json_encode($params));
         $channel->basic_publish($msg, '', 'search-index');
         $channel->close();
         $connection->close();
     } catch (\Exception $e) {
         $this->logger->warn("Queue Service when indexing entries: " . $e->getMessage());
     }
 }
开发者ID:bix0r,项目名称:Stjornvisi,代码行数:20,代码来源:ServiceIndexListener.php

示例7: onWebhookReceive

 /**
  * Callback on receive webhook
  * @param  EventInterface $event
  * @return void
  */
 public function onWebhookReceive(EventInterface $event)
 {
     /**
      * Retrieve the API from the target controller and inject into ourself
      */
     $controller = $event->getTarget();
     $context = $controller->getContext();
     $this->setPrismicApi($context->getPrismicApi());
     /**
      * Respond to the event
      */
     $type = $event->getParam('type');
     $this->lastPayload = $event->getParams();
     if ('api-update' === $type) {
         $this->clearCache();
     }
 }
开发者ID:netglue,项目名称:zf2-prismic-module,代码行数:22,代码来源:CacheBusterListener.php

示例8: notify

 /**
  * Send email notification of contact request
  *
  * @param EventInterface $event
  */
 public function notify(EventInterface $event)
 {
     $contact = $event->getParams();
     if (!$contact instanceof ContactEntity) {
         return;
     }
     $config = $this->getConfig();
     $message = new Message();
     $message->setFrom($config['contact']['from']);
     $message->setTo($config['contact']['email']);
     $message->setSubject("Contact Request from {$contact->getName()}");
     $message->setBody("Contact request ID {$contact->getId()}\n" . "Name: {$contact->getName()}\n" . "Email: {$contact->getEmail()}\n" . "\n---------------------------------\n" . $contact->getMessage());
     //        try {
     $this->getEmailService()->send($message);
     //        } catch (\Exception $e) {
     //            // TODO log failure
     //        }
 }
开发者ID:pdizz,项目名称:pdizz-web,代码行数:23,代码来源:ContactEmailListener.php

示例9: save

 public function save(EventInterface $e)
 {
     $log = new Log();
     $logTable = $this->serviceManager->get("Security\\Model\\LogTable");
     $params = $e->getParams();
     $authenticationService = new AuthenticationService();
     $user = $authenticationService->getIdentity()->id;
     if (isset($params['id']) && !empty($params['id'])) {
         $log->setTableId($params['id']);
     }
     $log->setTable($params['table']);
     $log->setOperation($params['operation']);
     if (isset($params['data'])) {
         $log->setData($params['data']);
     }
     $log->setUser($user);
     $logTable->save($log);
 }
开发者ID:kalelc,项目名称:inventory,代码行数:18,代码来源:LogListener.php

示例10: afterCreate

 public function afterCreate(EventInterface $msg)
 {
     $data = $msg->getParams();
     /*
     if ($data['operation'] == 'отдал') {
         $id = $this->boot()->get('good')->insert([
             'source_subject_id' => $data['target_subject_id'],
             'target_subject_id' => $data['source_subject_id'],
             'product_id' => $data['product_id'],
             'count' => $data['count'],
             'notes' => $data['notes'],
             'add_date' => $data['add_date'],
             'operation' => 'получил',
             'contr_entity_id' => $data['id'],
             'owner' => $data['owner'],
             'confirm' => 0
         ]);
         $this->boot()->get('good')->update($data['id'], [
             'contr_entity_id' => $id,
         ]);
     }
     
     if ($data['operation'] == 'получил') {
         $id = $this->boot()->get('good')->insert([
             'source_subject_id' => $data['target_subject_id'],
             'target_subject_id' => $data['source_subject_id'],
             'product_id' => $data['product_id'],
             'count' => $data['count'],
             'notes' => $data['notes'],
             'add_date' => $data['add_date'],
             'operation' => 'отдал',
             'contr_entity_id' => $data['id'],
             'owner' => $data['owner'],
             'confirm' => 0
         ]);
         $this->boot()->get('good')->update($data['id'], [
             'contr_entity_id' => $id,
         ]);
     }
     */
 }
开发者ID:rostmefpoter,项目名称:bh,代码行数:41,代码来源:Good.php

示例11: putObject

 /**
  * Put Object to S3
  *
  * @param EventInterface $event
  */
 public function putObject(EventInterface $event)
 {
     $params = $event->getParams();
     $config = $this->getServiceLocator()->get('Config');
     $imageFileName = basename(basename($params->getPath()));
     $thumbFileName = basename(basename($params->getThumbPath()));
     $awsSdk = $this->getServiceLocator()->get(AwsSdk::class);
     $s3Client = $awsSdk->createS3();
     // uploading image to S3
     try {
         $s3Client->putObject(array('Bucket' => $config['s3']['bucket']['name'], 'Key' => $config['s3']['fields']['path']['key_prefix'] . '/' . $imageFileName, 'Body' => fopen($params->getPath(), 'r'), 'ACL' => $config['s3']['bucket']['acl']));
     } catch (S3Exception $e) {
         //             var_dump($e->getMessage());
     }
     // uploading thumbnail to S3
     try {
         $s3Client->putObject(array('Bucket' => $config['s3']['bucket']['name'], 'Key' => $config['s3']['fields']['thumbPath']['key_prefix'] . '/' . $imageFileName, 'Body' => fopen($params->getThumbPath(), 'r'), 'ACL' => $config['s3']['bucket']['acl']));
     } catch (S3Exception $e) {
         //             var_dump($e->getMessage());
     }
 }
开发者ID:aqilix,项目名称:apigility-s3,代码行数:26,代码来源:SharedEventListener.php

示例12: doFirewall

 /**
  * Listen to the "user" event
  *
  * @param EventInterface $event
  * @return mixed
  */
 public function doFirewall(EventInterface $event)
 {
     $serviceManager = $this->getServiceLocator();
     $application = $serviceManager->get('Application');
     $request = $application->getRequest();
     if ($request instanceof ConsoleRequest) {
         return;
     }
     if ($serviceManager->get('config')['zoop']['pyro']['enable']) {
         $firewall = $event->getParams();
         if ($firewall instanceof Firewall) {
             $ipAddress = $this->getIpAddress();
             $this->triggerEvent(FirewallEvent::EVENT_FIREWALL_PRE_PROCESS, $firewall);
             try {
                 $firewall->process($ipAddress);
                 $this->triggerEvent(FirewallEvent::EVENT_FIREWALL_POST_PROCESS, $firewall);
             } catch (IpAddressDeniedException $e) {
                 $application->getResponse()->setStatusCode(403);
             }
         }
     }
 }
开发者ID:dollyaswin,项目名称:pyro,代码行数:28,代码来源:FirewallListener.php

示例13: thumbnailImage

 /**
  * Thumbnail Image
  *
  * @param EventInterface $event
  */
 public function thumbnailImage(EventInterface $event)
 {
     $params = $event->getParams();
     $config = $this->getServiceLocator()->get('Config');
     $thumbFilePath = $config['images']['thumb_path'] . DIRECTORY_SEPARATOR . basename($params->getPath());
     Resize::save($params->getPath(), $thumbFilePath, 200, 200);
     $params->setThumbPath($thumbFilePath);
 }
开发者ID:aqilix,项目名称:apigility-image,代码行数:13,代码来源:SharedEventListener.php

示例14: onEvent

 public function onEvent(EventInterface $event)
 {
     if ($event instanceof LogEvent) {
         $this->logger->log($event->getPriority(), $event->getMessage(), $event->getParams());
     }
 }
开发者ID:alex-oleshkevich,项目名称:zf-extras,代码行数:6,代码来源:LogEventListener.php

示例15: emailMissingTranslation

 /**
  * emailMissingTranslation
  *
  * @param EventInterface $event
  *
  * @return void
  */
 public function emailMissingTranslation($event)
 {
     $params = $event->getParams();
     $defaultLocale = $this->getDefaultLocale();
     if ($params['locale'] !== $defaultLocale) {
         // @todo write and implement this
     }
 }
开发者ID:reliv,项目名称:rcm-i18n,代码行数:15,代码来源:EmailMissingTranslationListener.php


注:本文中的Zend\EventManager\EventInterface::getParams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。