本文整理汇总了PHP中Magento\Framework\Event\ManagerInterface类的典型用法代码示例。如果您正苦于以下问题:PHP ManagerInterface类的具体用法?PHP ManagerInterface怎么用?PHP ManagerInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ManagerInterface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: 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
示例3: testProcessRelations
public function testProcessRelations()
{
$this->relationProcessorMock->expects($this->once())->method('processRelation')->with($this->salesModelMock);
$this->salesModelMock->expects($this->once())->method('getEventPrefix')->willReturn('sales_event_prefix');
$this->eventManagerMock->expects($this->once())->method('dispatch')->with('sales_event_prefix_process_relation', ['object' => $this->salesModelMock]);
$this->entityRelationComposite->processRelations($this->salesModelMock);
}
开发者ID:kid17,项目名称:magento2,代码行数:7,代码来源:EntityRelationCompositeTest.php
示例4: 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
示例5: 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
示例6: 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
示例7: 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
示例8: 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
示例9: 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
示例10: 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
示例11: 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
示例12: 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
示例13: 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
示例14: testGetHtmlTxnIdIsNull
public function testGetHtmlTxnIdIsNull()
{
$this->eventManagerMock->expects($this->once())->method('dispatch');
$this->transaction->setData('txn_id', 'test');
$this->assertEquals('test', $this->transaction->getHtmlTxnId());
$this->assertEquals(null, $this->transaction->getData('html_txn_id'));
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:7,代码来源:TransactionTest.php
示例15: 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
示例16: 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
示例17: testAfterSaveDispatchWithStore
public function testAfterSaveDispatchWithStore()
{
$this->designConfig->expects($this->exactly(2))->method('getScope')->willReturn('store');
$this->designConfig->expects($this->once())->method('getScopeId')->willReturn(1);
$this->storeManager->expects($this->once())->method('getStore')->with(1)->willReturn($this->store);
$this->eventManager->expects($this->once())->method('dispatch')->with('admin_system_config_changed_section_design', ['website' => '', 'store' => $this->store]);
$this->plugin->afterSave($this->repository, $this->designConfig);
}
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:8,代码来源:PluginTest.php
示例18: testIsAvailable
/**
* @param bool $result
*
* @dataProvider dataProviderForTestIsAvailable
*/
public function testIsAvailable($result)
{
$storeId = 15;
$this->quoteMock->expects($this->once())->method('getStoreId')->willReturn($storeId);
$this->scopeConfigMock->expects($this->once())->method('getValue')->with('payment/' . Stub::STUB_CODE . '/active', ScopeInterface::SCOPE_STORE, $storeId)->willReturn($result);
$this->eventManagerMock->expects($this->once())->method('dispatch')->with($this->equalTo('payment_method_is_active'), $this->countOf(3));
$this->assertEquals($result, $this->payment->isAvailable($this->quoteMock));
}
开发者ID:nja78,项目名称:magento2,代码行数:13,代码来源:AbstractMethodTest.php
示例19: modelToDataObject
/**
* Converts a specified rate model to a shipping method data object.
*
* @param \Magento\Quote\Model\Quote\Item $item
* @return array
* @throws \Exception
*/
public function modelToDataObject($item)
{
$this->eventManager->dispatch('items_additional_data', ['item' => $item]);
$items = $item->toArray();
$items['options'] = $this->getFormattedOptionValue($item);
$itemsData = $this->totalsItemFactory->create();
$this->dataObjectHelper->populateWithArray($itemsData, $items, '\\Magento\\Quote\\Api\\Data\\TotalsItemInterface');
return $itemsData;
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:16,代码来源:ItemConverter.php
示例20: 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类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论