本文整理汇总了PHP中Magento\Framework\DataObject::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP DataObject::getData方法的具体用法?PHP DataObject::getData怎么用?PHP DataObject::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\DataObject
的用法示例。
在下文中一共展示了DataObject::getData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareArrayRow
/**
* @param \Magento\Framework\DataObject $row
*/
public function _prepareArrayRow(\Magento\Framework\DataObject $row)
{
$options = [];
$options['option_' . $this->_getAttributeRenderer()->calcOptionHash($row->getData('attribute'))] = 'selected="selected"';
$options['option_' . $this->_getDatafieldRenderer()->calcOptionHash($row->getData('datafield'))] = 'selected="selected"';
$row->setData('option_extra_attrs', $options);
}
示例2: postRequest
/**
* Post request into gateway
*
* @param DataObject $request
* @param ConfigInterface $config
*
* @return DataObject
* @throws \Zend_Http_Client_Exception
*/
public function postRequest(DataObject $request, ConfigInterface $config)
{
$result = new DataObject();
$clientConfig = ['maxredirects' => 5, 'timeout' => 30, 'verifypeer' => $config->getValue('verify_peer')];
if ($config->getValue('use_proxy')) {
$clientConfig['proxy'] = $config->getValue('proxy_host') . ':' . $config->getValue('proxy_port');
$clientConfig['httpproxytunnel'] = true;
$clientConfig['proxytype'] = CURLPROXY_HTTP;
}
/** @var ZendClient $client */
$client = $this->httpClientFactory->create();
$client->setUri((bool) $config->getValue('sandbox_flag') ? $config->getValue('transaction_url_test_mode') : $config->getValue('transaction_url'));
$client->setConfig($clientConfig);
$client->setMethod(\Zend_Http_Client::POST);
$client->setParameterPost($request->getData());
$client->setHeaders(['X-VPS-VIT-CLIENT-CERTIFICATION-ID' => '33baf5893fc2123d8b191d2d011b7fdc', 'X-VPS-Request-ID' => $this->mathRandom->getUniqueHash(), 'X-VPS-CLIENT-TIMEOUT' => 45]);
$client->setUrlEncodeBody(false);
try {
$response = $client->request();
$responseArray = [];
parse_str(strstr($response->getBody(), 'RESULT'), $responseArray);
$result->setData(array_change_key_case($responseArray, CASE_LOWER));
$result->setData('result_code', $result->getData('result'));
} catch (\Zend_Http_Client_Exception $e) {
$result->addData(['response_code' => -1, 'response_reason_code' => $e->getCode(), 'response_reason_text' => $e->getMessage()]);
throw $e;
} finally {
$this->logger->debug(['request' => $request->getData(), 'result' => $result->getData()], (array) $config->getValue('getDebugReplacePrivateDataKeys'), (bool) $config->getValue('debug'));
}
return $result;
}
示例3: _prepareArrayRow
/**
* Assign extra parameters to row
*
*/
protected function _prepareArrayRow(\Magento\Framework\DataObject $row)
{
$optionExtraAttr = [];
$optionExtraAttr['option_' . $this->_getStatusRenderer()->calcOptionHash($row->getData('status'))] = 'selected="selected"';
$optionExtraAttr['option_' . $this->_getAutomationRenderer()->calcOptionHash($row->getData('automation'))] = 'selected="selected"';
$row->setData('option_extra_attrs', $optionExtraAttr);
}
示例4: render
/**
* {@inheritdoc}
*/
public function render(\Magento\Framework\DataObject $row)
{
if (!$row->getData($this->getColumn()->getIndex())) {
return null;
}
return '<a title="' . __('Edit Store View') . '"
href="' . $this->getUrl('adminhtml/*/editStore', ['store_id' => $row->getStoreId()]) . '">' . $this->escapeHtml($row->getData($this->getColumn()->getIndex())) . '</a>';
}
示例5: render
/**
* Render the description of given row.
*
* @param \Magento\Framework\DataObject $row
* @return string
*/
public function render(\Magento\Framework\DataObject $row)
{
$customerId = (int) $row->getData($this->getColumn()->getIndex());
if ($customerId > 0) {
return '<a href="' . $this->getUrl('customer/index/edit', array('id' => $customerId)) . '" target="_blank">' . $customerId . '</a>';
}
return nl2br(htmlspecialchars($row->getData($this->getColumn()->getIndex())));
}
示例6: _getValue
/**
* Renders grid column
*
* @param \Magento\Framework\DataObject $row
* @return mixed
*/
public function _getValue(\Magento\Framework\DataObject $row)
{
$result = '';
if ($row->getData('error_file') != '') {
$result = '<p> ' . $row->getData('error_file') . '</p><a href="' . $this->getUrl('*/*/download', ['filename' => $row->getData('error_file')]) . '">' . __('Download') . '</a>';
}
return $result;
}
示例7: _prepareArrayRow
/**
* @param \Magento\Framework\DataObject $row
*/
protected function _prepareArrayRow(\Magento\Framework\DataObject $row)
{
$options = [];
$options['option_' . $this->_getAttributeRenderer()->calcOptionHash($row->getData('attribute'))] = 'selected="selected"';
$options['option_' . $this->_getConditionsRenderer()->calcOptionHash($row->getData('conditions'))] = 'selected="selected"';
$options['option_' . $this->_getValueRenderer()->calcOptionHash($row->getData('cvalue'))] = 'selected="selected"';
$row->setData('option_extra_attrs', $options);
}
示例8: assignData
public function assignData(DataObject $data)
{
$additional_data = new DataObject($data->getAdditionalData());
$info_instance = $this->getInfoInstance();
$info_instance->setAdditionalInformation('ticket', $additional_data->getData('ticket_response_ticket'));
$info_instance->setAdditionalInformation('hmac', $additional_data->getData('ticket_response_monetra_resp_hmacsha256'));
$info_instance->setAdditionalInformation('sequence', $additional_data->getData('ticket_request_sequence'));
$info_instance->setAdditionalInformation('timestamp', $additional_data->getData('ticket_request_timestamp'));
return $this;
}
示例9: handle
/**
* {inheritdoc}
*/
public function handle(InfoInterface $payment, DataObject $response)
{
$importObject = [];
foreach ($this->fieldsToHandle as $field) {
if ($response->getData($field)) {
$importObject[$field] = $response->getData($field);
}
}
$this->paypalInfoManager->importToPayment($importObject, $payment);
}
示例10: render
/**
* Column renderer
*
* @param DataObject $row
* @return string
*/
public function render(DataObject $row)
{
$value = $row->getData($this->getColumn()->getIndex());
try {
$payload = json_encode(unserialize($row->getData('payload')));
} catch (\Exception $e) {
$payload = "?";
}
return '<span title="' . htmlentities($payload) . '">' . $value . '</span>';
}
示例11: handle
/**
* {inheritdoc}
*/
public function handle(InfoInterface $payment, DataObject $response)
{
if (!in_array($response->getData('result'), [Payflowpro::RESPONSE_CODE_DECLINED_BY_FILTER, Payflowpro::RESPONSE_CODE_FRAUDSERVICE_FILTER])) {
return;
}
$fraudMessages = ['RESPMSG' => $response->getData(self::RESPONSE_MESSAGE)];
if ($response->getData(self::FRAUD_RULES_XML)) {
$fraudMessages = array_merge($fraudMessages, $this->getFraudRulesDictionary($response->getData(self::FRAUD_RULES_XML)));
}
$this->paypalInfoManager->importToPayment([Info::FRAUD_FILTERS => array_merge($fraudMessages, (array) $payment->getAdditionalInformation(Info::FRAUD_FILTERS))], $payment);
}
示例12: _unserialize
/**
* Try to unserialize the attribute value
*
* @param \Magento\Framework\DataObject $object
* @return $this
*/
protected function _unserialize(\Magento\Framework\DataObject $object)
{
$attrCode = $this->getAttribute()->getAttributeCode();
if ($object->getData($attrCode)) {
try {
$unserialized = unserialize($object->getData($attrCode));
$object->setData($attrCode, $unserialized);
} catch (\Exception $e) {
$object->unsetData($attrCode);
}
}
return $this;
}
示例13: aroundValidate
/**
* @param \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend $subject
* @param \Closure $proceed
* @param \Magento\Framework\DataObject $entity
* @return bool
*/
public function aroundValidate(\Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend $subject, \Closure $proceed, \Magento\Framework\DataObject $entity)
{
$isAllowedType = !empty(array_filter(array_map(function ($allowedEntity) use($entity) {
return $entity instanceof $allowedEntity;
}, $this->allowedEntityTypes)));
if ($isAllowedType && $this->storeManager->getStore()->getId() !== Store::DEFAULT_STORE_ID) {
$attrCode = $subject->getAttribute()->getAttributeCode();
// Null is meaning "no value" which should be overridden by value from default scope
if (array_key_exists($attrCode, $entity->getData()) && $entity->getData($attrCode) === null) {
return true;
}
}
return $proceed($entity);
}
示例14: displayPriceAttribute
/**
* Display price attribute value in base order currency and in place order currency
*
* @param \Magento\Framework\DataObject $dataObject
* @param string $code
* @param bool $strong
* @param string $separator
* @return string
*/
public function displayPriceAttribute($dataObject, $code, $strong = false, $separator = '<br/>')
{
// Fix for 'bs_customer_bal_total_refunded' attribute
$baseValue = $dataObject->hasData('bs_' . $code)
? $dataObject->getData('bs_' . $code)
: $dataObject->getData('base_' . $code);
return $this->displayPrices(
$dataObject,
$baseValue,
$dataObject->getData($code),
$strong,
$separator
);
}
示例15: afterSave
/**
* Save uploaded file and set its name to category
*
* @param \Magento\Framework\DataObject $object
* @return \Magento\Catalog\Model\Category\Attribute\Backend\Image
*/
public function afterSave($object)
{
$value = $object->getData($this->getAttribute()->getName() . '_additional_data');
// if no image was set - nothing to do
if (empty($value) && empty($_FILES)) {
return $this;
}
if (is_array($value) && !empty($value['delete'])) {
$object->setData($this->getAttribute()->getName(), '');
$this->getAttribute()->getEntity()->saveAttribute($object, $this->getAttribute()->getName());
return $this;
}
$path = $this->_filesystem->getDirectoryRead(DirectoryList::MEDIA)->getAbsolutePath('catalog/category/');
try {
/** @var $uploader \Magento\MediaStorage\Model\File\Uploader */
$uploader = $this->_fileUploaderFactory->create(['fileId' => $this->getAttribute()->getName()]);
$uploader->setAllowedExtensions(['jpg', 'jpeg', 'gif', 'png']);
$uploader->setAllowRenameFiles(true);
$result = $uploader->save($path);
$object->setData($this->getAttribute()->getName(), $result['file']);
$this->getAttribute()->getEntity()->saveAttribute($object, $this->getAttribute()->getName());
} catch (\Exception $e) {
if ($e->getCode() != \Magento\MediaStorage\Model\File\Uploader::TMP_NAME_EMPTY) {
$this->_logger->critical($e);
}
}
return $this;
}