本文整理汇总了PHP中Mage_Core_Model_App::getRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_App::getRequest方法的具体用法?PHP Mage_Core_Model_App::getRequest怎么用?PHP Mage_Core_Model_App::getRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_App
的用法示例。
在下文中一共展示了Mage_Core_Model_App::getRequest方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: allowAddressValidation
/**
* Set the passed in address object to ignore validation only when
* we are currently saving an order and ROM Address validation is not
* needed.
*
* @param Mage_Customer_Model_Address_Abstract
* @return self
*/
public function allowAddressValidation(Mage_Customer_Model_Address_Abstract $address)
{
/** @var Mage_Core_Controller_Request_Http */
$request = $this->app->getRequest();
/** @var bool */
$needValidation = $this->validator->shouldValidateAddress($address);
// We only want to ignore address validation when we are actually creating an order.
// The assumption is if we get to this point, then, validating the address is
// unnecessary if it is already valid in ROM.
if (!$needValidation && $request->getActionName() === 'saveOrder') {
$address->setShouldIgnoreValidation(true);
}
return $this;
}
示例2: determineApiType
/**
* Determine current API type using application request (not web API request).
*
* @return string
* @throws Mage_Core_Exception
* @throws Mage_Webapi_Exception If requested API type is invalid.
*/
public function determineApiType()
{
if (is_null($this->_apiType)) {
$request = $this->_application->getRequest();
$apiRoute = $this->_routeFactory->createRoute('Mage_Webapi_Controller_Router_Route_Webapi', Mage_Webapi_Controller_Router_Route_Webapi::getApiRoute());
if (!($apiTypeMatch = $apiRoute->match($request, true))) {
throw new Mage_Webapi_Exception($this->_helper->__('Request does not match any API type route.'), Mage_Webapi_Exception::HTTP_BAD_REQUEST);
}
$apiType = $apiTypeMatch[Mage_Webapi_Controller_Router_Route_Webapi::PARAM_API_TYPE];
if (!in_array($apiType, $this->getListOfAvailableApiTypes())) {
throw new Mage_Webapi_Exception($this->_helper->__('The "%s" API type is not defined.', $apiType), Mage_Webapi_Exception::HTTP_BAD_REQUEST);
}
$this->_apiType = $apiType;
}
return $this->_apiType;
}
示例3: testSetGetRequest
public function testSetGetRequest()
{
$this->assertInstanceOf('Mage_Core_Controller_Request_Http', $this->_model->getRequest());
$this->_model->setRequest(new Magento_Test_Request());
$this->assertInstanceOf('Magento_Test_Request', $this->_model->getRequest());
}