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


PHP ManagerInterface::dispatch方法代码示例

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


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

示例1: resetSearchResults

 /**
  * Reset search results
  *
  * @return $this
  */
 public function resetSearchResults()
 {
     $connection = $this->getConnection();
     $connection->update($this->getTable('search_query'), ['is_processed' => 0], ['is_processed != 0']);
     $this->_eventManager->dispatch('catalogsearch_reset_search_result');
     return $this;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:Fulltext.php

示例2: aroundUpdateAttributes

 /**
  * @param Action $subject
  * @param \Closure $proceed
  * @param array $productIds
  * @param array $attrData
  * @param int $storeId
  * @return Action
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundUpdateAttributes(Action $subject, \Closure $proceed, $productIds, $attrData, $storeId)
 {
     $returnValue = $proceed($productIds, $attrData, $storeId);
     $this->cacheContext->registerEntities(Product::CACHE_TAG, $productIds);
     $this->eventManager->dispatch('clean_cache_by_tags', ['object' => $this->cacheContext]);
     return $returnValue;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:17,代码来源:UpdateAttributesFlushCache.php

示例3: convert

    /**
     * @param Address $object
     * @param array $data
     * @return OrderInterface
     */
    public function convert(Address $object, $data = [])
    {
        $orderData = $this->objectCopyService->getDataFromFieldset(
            'quote_convert_address',
            'to_order',
            $object
        );
        /**
         * @var $order \Magento\Sales\Model\Order
         */
        $order = $this->orderFactory->create();
        $this->dataObjectHelper->populateWithArray(
            $order,
            array_merge($orderData, $data),
            '\Magento\Sales\Api\Data\OrderInterface'
        );
        $order->setStoreId($object->getQuote()->getStoreId())
            ->setQuoteId($object->getQuote()->getId())
            ->setIncrementId($object->getQuote()->getReservedOrderId());
        $this->objectCopyService->copyFieldsetToTarget('sales_convert_quote', 'to_order', $object->getQuote(), $order);
        $this->eventManager->dispatch(
            'sales_convert_quote_to_order',
            ['order' => $order, 'quote' => $object->getQuote()]
        );
        return $order;

    }
开发者ID:razbakov,项目名称:magento2,代码行数:32,代码来源:ToOrder.php

示例4: resetSearchResults

 /**
  * Reset search results
  *
  * @return $this
  */
 public function resetSearchResults()
 {
     $adapter = $this->_getWriteAdapter();
     $adapter->update($this->getTable('search_query'), ['is_processed' => 0]);
     $this->_eventManager->dispatch('catalogsearch_reset_search_result');
     return $this;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:12,代码来源:Fulltext.php

示例5: getAvailableFrontendTypes

 /**
  * @return \Magento\Framework\Object
  */
 private function getAvailableFrontendTypes()
 {
     $availableFrontendTypes = $this->objectFactory->create();
     $availableFrontendTypes->setData(['values' => ['select']]);
     $this->eventManager->dispatch('product_suggested_attribute_frontend_type_init_after', ['types_dto' => $availableFrontendTypes]);
     return $availableFrontendTypes;
 }
开发者ID:shazal,项目名称:magento2,代码行数:10,代码来源:SuggestedAttributeList.php

示例6: afterDelete

 /**
  * @param DesignConfigRepository $subject
  * @param DesignConfigInterface $designConfig
  * @return DesignConfigInterface
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function afterDelete(DesignConfigRepository $subject, DesignConfigInterface $designConfig)
 {
     $website = in_array($designConfig->getScope(), [ScopeInterface::SCOPE_WEBSITE, ScopeInterface::SCOPE_WEBSITES]) ? $this->storeManager->getWebsite($designConfig->getScopeId()) : '';
     $store = in_array($designConfig->getScope(), [ScopeInterface::SCOPE_STORE, ScopeInterface::SCOPE_STORES]) ? $this->storeManager->getStore($designConfig->getScopeId()) : '';
     $this->eventManager->dispatch('admin_system_config_changed_section_design', ['website' => $website, 'store' => $store]);
     return $designConfig;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:13,代码来源:Plugin.php

示例7: copyFieldsetToTarget

 /**
  * Copy data from object|array to object|array containing fields from fieldset matching an aspect.
  *
  * Contents of $aspect are a field name in target object or array.
  * If targetField attribute is not provided - will be used the same name as in the source object or array.
  *
  * @param string $fieldset
  * @param string $aspect
  * @param array|\Magento\Framework\Object $source
  * @param array|\Magento\Framework\Object $target
  * @param string $root
  * @return array|\Magento\Framework\Object|null the value of $target
  *
  * @api
  */
 public function copyFieldsetToTarget($fieldset, $aspect, $source, $target, $root = 'global')
 {
     if (!$this->_isFieldsetInputValid($source, $target)) {
         return null;
     }
     $fields = $this->_fieldsetConfig->getFieldset($fieldset, $root);
     if ($fields === null) {
         return $target;
     }
     $targetIsArray = is_array($target);
     foreach ($fields as $code => $node) {
         if (empty($node[$aspect])) {
             continue;
         }
         $value = $this->_getFieldsetFieldValue($source, $code);
         $targetCode = (string) $node[$aspect];
         $targetCode = $targetCode == '*' ? $code : $targetCode;
         if ($targetIsArray) {
             $target[$targetCode] = $value;
         } else {
             $target->setDataUsingMethod($targetCode, $value);
         }
     }
     $eventName = sprintf('core_copy_fieldset_%s_%s', $fieldset, $aspect);
     $this->_eventManager->dispatch($eventName, ['target' => $target, 'source' => $source, 'root' => $root]);
     return $target;
 }
开发者ID:opexsw,项目名称:magento2,代码行数:42,代码来源:Copy.php

示例8: send

 /**
  * Send email to customer
  *
  * @param Order $order
  * @param bool $notify
  * @param string $comment
  * @return bool
  */
 public function send(Order $order, $notify = true, $comment = '')
 {
     $transport = ['order' => $order, 'comment' => $comment, 'billing' => $order->getBillingAddress(), 'store' => $order->getStore(), 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order)];
     $this->eventManager->dispatch('email_order_comment_set_template_vars_before', ['sender' => $this, 'transport' => $transport]);
     $this->templateContainer->setTemplateVars($transport);
     return $this->checkAndSend($order, $notify);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:15,代码来源:OrderCommentSender.php

示例9: dispatch

 /**
  * Dispatch request
  *
  * @param RequestInterface $request
  * @return ResponseInterface
  * @throws NotFoundException
  */
 public function dispatch(RequestInterface $request)
 {
     $this->_request = $request;
     $profilerKey = 'CONTROLLER_ACTION:' . $request->getFullActionName();
     $eventParameters = ['controller_action' => $this, 'request' => $request];
     $this->_eventManager->dispatch('controller_action_predispatch', $eventParameters);
     $this->_eventManager->dispatch('controller_action_predispatch_' . $request->getRouteName(), $eventParameters);
     $this->_eventManager->dispatch('controller_action_predispatch_' . $request->getFullActionName(), $eventParameters);
     \Magento\Framework\Profiler::start($profilerKey);
     $result = null;
     if ($request->isDispatched() && !$this->_actionFlag->get('', self::FLAG_NO_DISPATCH)) {
         \Magento\Framework\Profiler::start('action_body');
         $result = $this->execute();
         \Magento\Framework\Profiler::start('postdispatch');
         if (!$this->_actionFlag->get('', self::FLAG_NO_POST_DISPATCH)) {
             $this->_eventManager->dispatch('controller_action_postdispatch_' . $request->getFullActionName(), $eventParameters);
             $this->_eventManager->dispatch('controller_action_postdispatch_' . $request->getRouteName(), $eventParameters);
             $this->_eventManager->dispatch('controller_action_postdispatch', $eventParameters);
         }
         \Magento\Framework\Profiler::stop('postdispatch');
         \Magento\Framework\Profiler::stop('action_body');
     }
     \Magento\Framework\Profiler::stop($profilerKey);
     return $result ?: $this->_response;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:32,代码来源:Action.php

示例10: updateAndGetTranslations

 /**
  * Clears cache and updates translations file
  *
  * @return array
  */
 public function updateAndGetTranslations()
 {
     $this->eventManager->dispatch('adminhtml_cache_flush_system');
     $translations = $this->translateResource->getTranslationArray(null, $this->localeResolver->getLocale());
     $this->fileManager->updateTranslationFileContent(json_encode($translations));
     return $translations;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:CacheManager.php

示例11: launch

 /**
  * Run application
  *
  * @return ResponseInterface
  */
 public function launch()
 {
     $this->_state->setAreaCode('crontab');
     $this->_eventManager->dispatch('default');
     $this->_response->setCode(0);
     return $this->_response;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:Cron.php

示例12: executeFull

 /**
  * Execute full indexation
  *
  * @return void
  */
 public function executeFull()
 {
     $this->indexBuilder->reindexFull();
     $this->_eventManager->dispatch('clean_cache_by_tags', ['object' => $this]);
     //TODO: remove after fix fpc. MAGETWO-50668
     $this->getCacheManager()->clean($this->getIdentities());
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:AbstractIndexer.php

示例13: processRelations

 /**
  * Process model's relations saves
  *
  * @param AbstractModel $object
  * @return void
  */
 public function processRelations(AbstractModel $object)
 {
     foreach ($this->relationProcessors as $processor) {
         /**@var $processor RelationInterface*/
         $processor->processRelation($object);
     }
     $this->eventManager->dispatch($object->getEventPrefix() . '_process_relation', ['object' => $object]);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:RelationComposite.php

示例14: getProductCollection

 /**
  * @return $this|\Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
  */
 public function getProductCollection()
 {
     /** @var $reviewModel \Magento\Review\Model\Review */
     $reviewModel = $this->reviewFactory->create();
     $collection = $reviewModel->getProductCollection()->addStatusFilter($reviewModel->getPendingStatus())->addAttributeToSelect('name', 'inner')->setDateOrder();
     $this->eventManager->dispatch('rss_catalog_review_collection_select', ['collection' => $collection]);
     return $collection;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:11,代码来源:Rss.php

示例15: format

 /**
  * Format address in a specific way
  *
  * @param DataObject $storeInfo
  * @param string $type
  * @return string
  */
 public function format(DataObject $storeInfo, $type = 'html')
 {
     $this->eventManager->dispatch('store_address_format', ['type' => $type, 'store_info' => $storeInfo]);
     $address = $this->filterManager->template("{{var name}}\n{{var street_line1}}\n{{depend street_line2}}{{var street_line2}}\n{{/depend}}" . "{{var city}}, {{var region}} {{var postcode}},\n{{var country}}", ['variables' => $storeInfo->getData()]);
     if ($type == 'html') {
         $address = nl2br($address);
     }
     return $address;
 }
开发者ID:IlyaGluschenko,项目名称:protection,代码行数:16,代码来源:Renderer.php


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