本文整理汇总了PHP中Magento_Profiler类的典型用法代码示例。如果您正苦于以下问题:PHP Magento_Profiler类的具体用法?PHP Magento_Profiler怎么用?PHP Magento_Profiler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Magento_Profiler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _beforeToHtml
protected function _beforeToHtml()
{
Magento_Profiler::start('customer/tabs');
/*
if (Mage::registry('current_customer')->getId()) {
$this->addTab('view', array(
'label' => Mage::helper('Mage_Customer_Helper_Data')->__('Customer View'),
'content' => $this->getLayout()->createBlock('Mage_Adminhtml_Block_Customer_Edit_Tab_View')->toHtml(),
'active' => true
));
}
*/
$this->addTab('account', array('label' => Mage::helper('Mage_Customer_Helper_Data')->__('Account Information'), 'content' => $this->getLayout()->createBlock('Mage_Adminhtml_Block_Customer_Edit_Tab_Account')->initForm()->toHtml(), 'active' => Mage::registry('current_customer')->getId() ? false : true));
$this->addTab('addresses', array('label' => Mage::helper('Mage_Customer_Helper_Data')->__('Addresses'), 'content' => $this->getLayout()->createBlock('Mage_Adminhtml_Block_Customer_Edit_Tab_Addresses')->initForm()->toHtml()));
// load: Orders, Shopping Cart, Wishlist, Product Reviews, Product Tags - with ajax
if (Mage::registry('current_customer')->getId()) {
if (Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Sales::actions_view')) {
$this->addTab('orders', array('label' => Mage::helper('Mage_Customer_Helper_Data')->__('Orders'), 'class' => 'ajax', 'url' => $this->getUrl('*/*/orders', array('_current' => true))));
}
$this->addTab('cart', array('label' => Mage::helper('Mage_Customer_Helper_Data')->__('Shopping Cart'), 'class' => 'ajax', 'url' => $this->getUrl('*/*/carts', array('_current' => true))));
$this->addTab('wishlist', array('label' => Mage::helper('Mage_Customer_Helper_Data')->__('Wishlist'), 'class' => 'ajax', 'url' => $this->getUrl('*/*/wishlist', array('_current' => true))));
if (Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Newsletter::subscriber')) {
$this->addTab('newsletter', array('label' => Mage::helper('Mage_Customer_Helper_Data')->__('Newsletter'), 'content' => $this->getLayout()->createBlock('Mage_Adminhtml_Block_Customer_Edit_Tab_Newsletter')->initForm()->toHtml()));
}
if (Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Review::reviews_ratings')) {
$this->addTab('reviews', array('label' => Mage::helper('Mage_Customer_Helper_Data')->__('Product Reviews'), 'class' => 'ajax', 'url' => $this->getUrl('*/*/productReviews', array('_current' => true))));
}
}
$this->_updateActiveTab();
Magento_Profiler::stop('customer/tabs');
return parent::_beforeToHtml();
}
开发者ID:nemphys,项目名称:magento2,代码行数:32,代码来源:Tabs.php
示例2: _toHtml
protected function _toHtml()
{
/* @var $template Mage_Newsletter_Model_Template */
$template = Mage::getModel('Mage_Newsletter_Model_Template');
if ($id = (int) $this->getRequest()->getParam('id')) {
$queue = Mage::getModel('Mage_Newsletter_Model_Queue');
$queue->load($id);
$template->setTemplateType($queue->getNewsletterType());
$template->setTemplateText($queue->getNewsletterText());
$template->setTemplateStyles($queue->getNewsletterStyles());
} else {
$template->setTemplateType($this->getRequest()->getParam('type'));
$template->setTemplateText($this->getRequest()->getParam('text'));
$template->setTemplateStyles($this->getRequest()->getParam('styles'));
}
$storeId = (int) $this->getRequest()->getParam('store_id');
if (!$storeId) {
$storeId = Mage::app()->getDefaultStoreView()->getId();
}
Magento_Profiler::start("newsletter_queue_proccessing");
$vars = array();
$vars['subscriber'] = Mage::getModel('Mage_Newsletter_Model_Subscriber');
$template->emulateDesign($storeId);
$templateProcessed = $template->getProcessedTemplate($vars, true);
$template->revertDesign();
if ($template->isPlain()) {
$templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>";
}
Magento_Profiler::stop("newsletter_queue_proccessing");
return $templateProcessed;
}
开发者ID:natxetee,项目名称:magento2,代码行数:31,代码来源:Preview.php
示例3: init
/**
* Initialization session namespace
*
* @param string $namespace
*/
public function init($namespace)
{
if (!Zend_Session::sessionExists()) {
$this->start();
}
Magento_Profiler::start(__METHOD__ . '/init');
$this->_namespace = new Zend_Session_Namespace($namespace, Zend_Session_Namespace::SINGLE_INSTANCE);
Magento_Profiler::stop(__METHOD__ . '/init');
return $this;
}
开发者ID:natxetee,项目名称:magento2,代码行数:15,代码来源:Zend.php
示例4: __construct
/**
* @param string $definitionsFile
* @param Zend\Di\Di $diInstance
*/
public function __construct($definitionsFile = null, Zend\Di\Di $diInstance = null)
{
Magento_Profiler::start('di');
if (is_file($definitionsFile) && is_readable($definitionsFile)) {
$definition = new Magento_Di_Definition_ArrayDefinition_Zend(unserialize(file_get_contents($definitionsFile)));
} else {
$definition = new Magento_Di_Definition_RuntimeDefinition_Zend();
}
$this->_di = $diInstance ? $diInstance : new Magento_Di();
$this->_di->setDefinitionList(new Magento_Di_DefinitionList_Zend($definition));
$this->_di->instanceManager()->addSharedInstance($this, 'Magento_ObjectManager');
Magento_Profiler::stop('di');
}
开发者ID:nickimproove,项目名称:magento2,代码行数:17,代码来源:Zend.php
示例5: dispatch
/**
* Dispatches an event to observer's callback
*
* @param Varien_Event $event
* @return Varien_Event_Observer
*/
public function dispatch(Varien_Event $event)
{
if (!$this->isValidFor($event)) {
return $this;
}
$callback = $this->getCallback();
$this->setEvent($event);
$_profilerKey = 'OBSERVER: ' . (is_object($callback[0]) ? get_class($callback[0]) : (string) $callback[0]) . ' -> ' . $callback[1];
Magento_Profiler::start($_profilerKey);
call_user_func($callback, $this);
Magento_Profiler::stop($_profilerKey);
return $this;
}
开发者ID:relue,项目名称:magento2,代码行数:19,代码来源:Observer.php
示例6: _aggregateTimerValues
/**
* Calculate metric value from set of timer names
*
* @param array $timerNames
* @param string $fetchKey
* @return int
*/
protected function _aggregateTimerValues(array $timerNames, $fetchKey = Magento_Profiler::FETCH_AVG)
{
/* Prepare pattern that matches timers with deepest nesting level only */
$nestingSep = preg_quote(Magento_Profiler::NESTING_SEPARATOR, '/');
array_map('preg_quote', $timerNames, array('/'));
$pattern = '/(?<=' . $nestingSep . '|^)(?:' . implode('|', $timerNames) . ')$/';
/* Sum profiler values for matched timers */
$result = 0;
foreach ($this->_getTimers() as $timerId) {
if (preg_match($pattern, $timerId)) {
$result += Magento_Profiler::fetch($timerId, $fetchKey);
}
}
/* Convert seconds -> milliseconds */
$result = round($result * 1000);
return $result;
}
开发者ID:relue,项目名称:magento2,代码行数:24,代码来源:OutputBamboo.php
示例7: _toHtml
protected function _toHtml()
{
$template = Mage::getModel('Mage_Core_Model_Email_Template');
if ($id = (int) $this->getRequest()->getParam('id')) {
$template->load($id);
} else {
$template->setTemplateType($this->getRequest()->getParam('type'));
$template->setTemplateText($this->getRequest()->getParam('text'));
$template->setTemplateStyles($this->getRequest()->getParam('styles'));
}
$template->setTemplateText($this->escapeHtml($template->getTemplateText()));
Magento_Profiler::start("email_template_proccessing");
$vars = array();
$templateProcessed = $template->getProcessedTemplate($vars, true);
if ($template->isPlain()) {
$templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>";
}
Magento_Profiler::stop("email_template_proccessing");
return $templateProcessed;
}
开发者ID:relue,项目名称:magento2,代码行数:20,代码来源:Preview.php
示例8: _toHtml
/**
* Prepare html output
*
* @return string
*/
protected function _toHtml()
{
/** @var $template Mage_Core_Model_Email_Template */
$template = Mage::getModel('Mage_Core_Model_Email_Template');
$id = (int) $this->getRequest()->getParam('id');
if ($id) {
$template->load($id);
} else {
$template->setTemplateType($this->getRequest()->getParam('type'));
$template->setTemplateText($this->getRequest()->getParam('text'));
$template->setTemplateStyles($this->getRequest()->getParam('styles'));
}
/* @var $filter Mage_Core_Model_Input_Filter_MaliciousCode */
$filter = Mage::getSingleton('Mage_Core_Model_Input_Filter_MaliciousCode');
$template->setTemplateText($filter->filter($template->getTemplateText()));
Magento_Profiler::start("email_template_proccessing");
$vars = array();
$templateProcessed = $template->getProcessedTemplate($vars, true);
if ($template->isPlain()) {
$templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>";
}
Magento_Profiler::stop("email_template_proccessing");
return $templateProcessed;
}
开发者ID:nemphys,项目名称:magento2,代码行数:29,代码来源:Preview.php
示例9: getCategoryIdUrl
/**
* Retrieve category id URL
*
* @return string
*/
public function getCategoryIdUrl()
{
Magento_Profiler::start('REGULAR: ' . __METHOD__, array('group' => 'REGULAR', 'method' => __METHOD__));
$urlKey = $this->getUrlKey() ? $this->getUrlKey() : $this->formatUrlKey($this->getName());
$url = $this->getUrlInstance()->getUrl('catalog/category/view', array('s' => $urlKey, 'id' => $this->getId()));
Magento_Profiler::stop('REGULAR: ' . __METHOD__);
return $url;
}
开发者ID:natxetee,项目名称:magento2,代码行数:13,代码来源:Category.php
示例10: run
/**
* Front end main entry point
*
* @param string $code
* @param string $type
* @param string|array $options
*/
public static function run($code = '', $type = 'store', $options = array())
{
try {
Magento_Profiler::start('mage');
self::setRoot();
if (isset($options['edition'])) {
self::$_currentEdition = $options['edition'];
}
self::$_app = new Mage_Core_Model_App();
if (isset($options['request'])) {
self::$_app->setRequest($options['request']);
}
if (isset($options['response'])) {
self::$_app->setResponse($options['response']);
}
self::$_events = new Varien_Event_Collection();
self::_setIsInstalled($options);
self::_setConfigModel($options);
self::$_app->run(array('scope_code' => $code, 'scope_type' => $type, 'options' => $options));
Magento_Profiler::stop('mage');
} catch (Mage_Core_Model_Session_Exception $e) {
header('Location: ' . self::getBaseUrl());
} catch (Mage_Core_Model_Store_Exception $e) {
require_once self::getBaseDir() . '/pub/errors/404.php';
} catch (Exception $e) {
self::printException($e);
}
}
开发者ID:nemphys,项目名称:magento2,代码行数:35,代码来源:Mage.php
示例11: start
/**
* Configure session handler and start session
*
* @param string $sessionName
* @return Mage_Core_Model_Session_Abstract
*/
public function start($sessionName = null)
{
if (isset($_SESSION) && !$this->getSkipEmptySessionCheck()) {
return $this;
}
switch ($this->getSessionSaveMethod()) {
case 'db':
ini_set('session.save_handler', 'user');
$sessionResource = Mage::getResourceSingleton('Mage_Core_Model_Resource_Session');
/* @var $sessionResource Mage_Core_Model_Resource_Session */
$sessionResource->setSaveHandler();
break;
case 'memcache':
ini_set('session.save_handler', 'memcache');
session_save_path($this->getSessionSavePath());
break;
case 'memcached':
ini_set('session.save_handler', 'memcached');
session_save_path($this->getSessionSavePath());
break;
case 'eaccelerator':
ini_set('session.save_handler', 'eaccelerator');
break;
default:
session_module_name($this->getSessionSaveMethod());
if (is_writable($this->getSessionSavePath())) {
session_save_path($this->getSessionSavePath());
}
break;
}
$cookie = $this->getCookie();
// session cookie params
$cookieParams = array('lifetime' => 0, 'path' => $cookie->getPath(), 'domain' => $cookie->getConfigDomain(), 'secure' => $cookie->isSecure(), 'httponly' => $cookie->getHttponly());
if (!$cookieParams['httponly']) {
unset($cookieParams['httponly']);
if (!$cookieParams['secure']) {
unset($cookieParams['secure']);
if (!$cookieParams['domain']) {
unset($cookieParams['domain']);
}
}
}
if (isset($cookieParams['domain'])) {
$cookieParams['domain'] = $cookie->getDomain();
}
call_user_func_array('session_set_cookie_params', $cookieParams);
if (!empty($sessionName)) {
$this->setSessionName($sessionName);
}
// potential custom logic for session id (ex. switching between hosts)
$this->setSessionId();
Magento_Profiler::start('session_start');
$sessionCacheLimiter = Mage::getConfig()->getNode('global/session_cache_limiter');
if ($sessionCacheLimiter) {
session_cache_limiter((string) $sessionCacheLimiter);
}
session_start();
Magento_Profiler::stop('session_start');
return $this;
}
开发者ID:nemphys,项目名称:magento2,代码行数:66,代码来源:Abstract.php
示例12: _loadPart
/**
* Loading part of area
*
* @param string $part
* @return Mage_Core_Model_App_Area
*/
protected function _loadPart($part)
{
if (isset($this->_loadedParts[$part])) {
return $this;
}
Magento_Profiler::start('load_area:' . $this->_code . '.' . $part);
switch ($part) {
case self::PART_CONFIG:
$this->_initConfig();
break;
case self::PART_EVENTS:
$this->_initEvents();
break;
case self::PART_TRANSLATE:
$this->_initTranslate();
break;
case self::PART_DESIGN:
$this->_initDesign();
break;
}
$this->_loadedParts[$part] = true;
Magento_Profiler::stop('load_area:' . $this->_code . '.' . $part);
return $this;
}
开发者ID:nemphys,项目名称:magento2,代码行数:30,代码来源:Area.php
示例13: _getTimers
/**
* Retrieve the list of timer Ids
*
* @return array
*/
protected function _getTimers()
{
$pattern = $this->_filter;
$timerIds = $this->_getSortedTimers();
$result = array();
foreach ($timerIds as $timerId) {
/* Filter by timer id pattern */
if ($pattern && !preg_match($pattern, $timerId)) {
continue;
}
/* Filter by column value thresholds */
$skip = false;
foreach ($this->_thresholds as $fetchKey => $minAllowedValue) {
$skip = Magento_Profiler::fetch($timerId, $fetchKey) < $minAllowedValue;
/* First value not less than the allowed one forces to include timer to the result */
if (!$skip) {
break;
}
}
if (!$skip) {
$result[] = $timerId;
}
}
return $result;
}
开发者ID:natxetee,项目名称:magento2,代码行数:30,代码来源:OutputAbstract.php
示例14: _assignProducts
/**
* Add products to items and item options
*
* @return Mage_Sales_Model_Resource_Quote_Item_Collection
*/
protected function _assignProducts()
{
Magento_Profiler::start('QUOTE:' . __METHOD__);
$productIds = array();
foreach ($this as $item) {
$productIds[] = (int) $item->getProductId();
}
$this->_productIds = array_merge($this->_productIds, $productIds);
$productCollection = Mage::getModel('Mage_Catalog_Model_Product')->getCollection()->setStoreId($this->getStoreId())->addIdFilter($this->_productIds)->addAttributeToSelect(Mage::getSingleton('Mage_Sales_Model_Quote_Config')->getProductAttributes())->addOptionsToResult()->addStoreFilter()->addUrlRewrite()->addTierPriceData();
Mage::dispatchEvent('prepare_catalog_product_collection_prices', array('collection' => $productCollection, 'store_id' => $this->getStoreId()));
Mage::dispatchEvent('sales_quote_item_collection_products_after_load', array('product_collection' => $productCollection));
$recollectQuote = false;
foreach ($this as $item) {
$product = $productCollection->getItemById($item->getProductId());
if ($product) {
$product->setCustomOptions(array());
$qtyOptions = array();
$optionProductIds = array();
foreach ($item->getOptions() as $option) {
/**
* Call type-specific logic for product associated with quote item
*/
$product->getTypeInstance()->assignProductToOption($productCollection->getItemById($option->getProductId()), $option, $product);
if (is_object($option->getProduct()) && $option->getProduct()->getId() != $product->getId()) {
$optionProductIds[$option->getProduct()->getId()] = $option->getProduct()->getId();
}
}
if ($optionProductIds) {
foreach ($optionProductIds as $optionProductId) {
$qtyOption = $item->getOptionByCode('product_qty_' . $optionProductId);
if ($qtyOption) {
$qtyOptions[$optionProductId] = $qtyOption;
}
}
}
$item->setQtyOptions($qtyOptions)->setProduct($product);
} else {
$item->isDeleted(true);
$recollectQuote = true;
}
$item->checkData();
}
if ($recollectQuote && $this->_quote) {
$this->_quote->collectTotals();
}
Magento_Profiler::stop('QUOTE:' . __METHOD__);
return $this;
}
开发者ID:nemphys,项目名称:magento2,代码行数:53,代码来源:Collection.php
示例15: endTest
/**
* A test ended.
* Method signature is implied by implemented interface, not all parameters are needed.
*
* @param PHPUnit_Framework_Test $test
* @param float $time
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function endTest(PHPUnit_Framework_Test $test, $time)
{
if (!$test instanceof PHPUnit_Framework_TestCase || $test instanceof PHPUnit_Framework_Warning) {
return;
}
$this->_notifyObservers('endTest', true);
$this->_currentTest = null;
Magento_Profiler::stop('integration_test');
}
开发者ID:natxetee,项目名称:magento2,代码行数:18,代码来源:Listener.php
示例16: preloadAttributes
/**
* Preload entity type attributes for performance optimization
*
* @param mixed $entityType
* @param mixed $attributes
* @return Mage_Eav_Model_Config
*/
public function preloadAttributes($entityType, $attributes)
{
if (is_string($attributes)) {
$attributes = array($attributes);
}
$entityType = $this->getEntityType($entityType);
$entityTypeCode = $entityType->getEntityTypeCode();
if (!isset($this->_preloadedAttributes[$entityTypeCode])) {
$this->_preloadedAttributes[$entityTypeCode] = $attributes;
} else {
$attributes = array_diff($attributes, $this->_preloadedAttributes[$entityTypeCode]);
$this->_preloadedAttributes[$entityTypeCode] = array_merge($this->_preloadedAttributes[$entityTypeCode], $attributes);
}
if (empty($attributes)) {
return $this;
}
Magento_Profiler::start('EAV: ' . __METHOD__ . ':' . $entityTypeCode);
$attributesInfo = Mage::getResourceModel($entityType->getEntityAttributeCollection())->setEntityTypeFilter($entityType)->setCodeFilter($attributes)->getData();
if (!$attributesInfo) {
Magento_Profiler::stop('EAV: ' . __METHOD__ . ':' . $entityTypeCode);
return $this;
}
$attributesData = $codes = array();
foreach ($attributesInfo as $attribute) {
if (empty($attribute['attribute_model'])) {
$attribute['attribute_model'] = $entityType->getAttributeModel();
}
$attributeCode = $attribute['attribute_code'];
$attributeId = $attribute['attribute_id'];
$this->_addAttributeReference($attributeId, $attributeCode, $entityTypeCode);
$attributesData[$attributeCode] = $attribute;
$codes[] = $attributeCode;
}
$this->_attributeData[$entityTypeCode] = $attributesData;
Magento_Profiler::stop('EAV: ' . __METHOD__ . ':' . $entityTypeCode);
return $this;
}
开发者ID:relue,项目名称:magento2,代码行数:44,代码来源:Config.php
示例17: updateRuleProductData
/**
* Update products which are matched for rule
*
* @param Mage_CatalogRule_Model_Rule $rule
*
* @return Mage_CatalogRule_Model_Resource_Rule
*/
public function updateRuleProductData(Mage_CatalogRule_Model_Rule $rule)
{
$ruleId = $rule->getId();
$write = $this->_getWriteAdapter();
$write->beginTransaction();
if ($rule->getProductsFilter()) {
$write->delete($this->getTable('catalogrule_product'), array('rule_id=?' => $ruleId, 'product_id IN (?)' => $rule->getProductsFilter()));
} else {
$write->delete($this->getTable('catalogrule_product'), $write->quoteInto('rule_id=?', $ruleId));
}
if (!$rule->getIsActive()) {
$write->commit();
return $this;
}
$websiteIds = $rule->getWebsiteIds();
if (!is_array($websiteIds)) {
$websiteIds = explode(',', $websiteIds);
}
if (empty($websiteIds)) {
return $this;
}
Magento_Profiler::start('__MATCH_PRODUCTS__');
$productIds = $rule->getMatchingProductIds();
Magento_Profiler::stop('__MATCH_PRODUCTS__');
$customerGroupIds = $rule->getCustomerGroupIds();
$fromTime = strtotime($rule->getFromDate());
$toTime = strtotime($rule->getToDate());
$toTime = $toTime ? $toTime + self::SECONDS_IN_DAY - 1 : 0;
$sortOrder = (int) $rule->getSortOrder();
$actionOperator = $rule->getSimpleAction();
$actionAmount = $rule->getDiscountAmount();
$subActionOperator = $rule->getSubIsEnable() ? $rule->getSubSimpleAction() : '';
$subActionAmount = $rule->getSubDiscountAmount();
$actionStop = $rule->getStopRulesProcessing();
$rows = array();
try {
foreach ($productIds as $productId) {
foreach ($websiteIds as $websiteId) {
foreach ($customerGroupIds as $customerGroupId) {
$rows[] = array('rule_id' => $ruleId, 'from_time' => $fromTime, 'to_time' => $toTime, 'website_id' => $websiteId, 'customer_group_id' => $customerGroupId, 'product_id' => $productId, 'action_operator' => $actionOperator, 'action_amount' => $actionAmount, 'action_stop' => $actionStop, 'sort_order' => $sortOrder, 'sub_simple_action' => $subActionOperator, 'sub_discount_amount' => $subActionAmount);
if (count($rows) == 1000) {
$write->insertMultiple($this->getTable('catalogrule_product'), $rows);
$rows = array();
}
}
}
}
if (!empty($rows)) {
$write->insertMultiple($this->getTable('catalogrule_product'), $rows);
}
$write->commit();
} catch (Exception $e) {
$write->rollback();
throw $e;
}
return $this;
}
开发者ID:natxetee,项目名称:magento2,代码行数:64,代码来源:Rule.php
示例18: _afterLoad
/**
* After load collection process
*
* @return Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection
*/
protected function _afterLoad()
{
parent::_afterLoad();
Magento_Profiler::start('TTT1:' . __METHOD__, array('group' => 'TTT1', 'method' => __METHOD__));
$this->_addProductAttributes();
Magento_Profiler::stop('TTT1:' . __METHOD__);
Magento_Profiler::start('TTT2:' . __METHOD__, array('group' => 'TTT2', 'method' => __METHOD__));
$this->_addAssociatedProductFilters();
Magento_Profiler::stop('TTT2:' . __METHOD__);
Magento_Profiler::start('TTT3:' . __METHOD__, array('group' => 'TTT3', 'method' => __METHOD__));
$this->_loadLabels();
Magento_Profiler::stop('TTT3:' . __METHOD__);
Magento_Profiler::start('TTT4:' . __METHOD__, array('group' => 'TTT4', 'method' => __METHOD__));
$this->_loadPrices();
Magento_Profiler::stop('TTT4:' . __METHOD__);
return $this;
}
开发者ID:natxetee,项目名称:magento2,代码行数:22,代码来源:Collection.php
示例19: getModelInstance
/**
* Get model class instance.
*
* Example:
* $config->getModelInstance('catalog/product')
*
* Will instantiate Mage_Catalog_Model_Resource_Product
*
* @param string $modelClass
* @param array|object $constructArguments
* @return Mage_Core_Model_Abstract|false
*/
public function getModelInstance($modelClass = '', $constructArguments = array())
{
$className = $this->getModelClassName($modelClass);
if (class_exists($className)) {
Magento_Profiler::start('FACTORY:' . $className);
$obj = new $className($constructArguments);
Magento_Profiler::stop('FACTORY:' . $className);
return $obj;
} else {
return false;
}
}
开发者ID:nemphys,项目名称:magento2,代码行数:24,代码来源:Config.php
示例20: dispatch
public function dispatch()
{
$request = $this->getRequest();
// If pre-configured, check equality of base URL and requested URL
$this->_checkBaseUrl($request);
Magento_Profiler::start('dispatch');
$request->setPathInfo()->setDispatched(false);
if (!$request->isStraight()) {
Magento_Profiler::start('db_url_rewrite');
Mage::getModel('Mage_Core_Model_Url_Rewrite')->rewrite();
Magento_Profiler::stop('db_url_rewrite');
}
Magento_Profiler::start('config_url_rewrite');
$this->rewrite();
Magento_Profiler::stop('config_url_rewrite');
Magento_Profiler::stop('dispatch');
Magento_Profiler::start('routers_match');
$i = 0;
while (!$request->isDispatched() && $i++ < 100) {
foreach ($this->_routers as $router) {
if ($router->match($this->getRequest())) {
break;
}
}
}
Magento_Profiler::stop('routers_match');
if ($i > 100) {
Mage::throwException('Front controller reached 100 router match iterations');
}
//This event give possibility to launch smth before sending ouptut(Allow cookie setting)
Mage::dispatchEvent('controller_front_send_response_before', array('front' => $this));
Magento_Profiler::start('send_response');
$this->getResponse()->sendResponse();
Magento_Profiler::stop('send_response');
Mage::dispatchEvent('controller_front_send_response_after', array('front' => $this));
return $this;
}
开发者ID:relue,项目名称:magento2,代码行数:37,代码来源:Front.php
注:本文中的Magento_Profiler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论