當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Object::getId方法代碼示例

本文整理匯總了PHP中Magento\Framework\Object::getId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Object::getId方法的具體用法?PHP Object::getId怎麽用?PHP Object::getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\Object的用法示例。


在下文中一共展示了Object::getId方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: render

 /**
  * Renders grid column
  *
  * @param   \Magento\Framework\Object $row
  * @return  string
  */
 public function render(\Magento\Framework\Object $row)
 {
     $readDetailsHtml = $row->getUrl() ? '<a class="action-details" target="_blank" href="' . $row->getUrl() . '">' . __('Read Details') . '</a>' : '';
     $markAsReadHtml = !$row->getIsRead() ? '<a class="action-mark" href="' . $this->getUrl('*/*/markAsRead/', array('_current' => true, 'id' => $row->getId())) . '">' . __('Mark as Read') . '</a>' : '';
     $encodedUrl = $this->_urlHelper->getEncodedUrl();
     return sprintf('%s%s<a class="action-delete" href="%s" onClick="deleteConfirm(\'%s\', this.href); return false;">%s</a>', $readDetailsHtml, $markAsReadHtml, $this->getUrl('*/*/remove/', array('_current' => true, 'id' => $row->getId(), \Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED => $encodedUrl)), __('Are you sure?'), __('Remove'));
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:13,代碼來源:Actions.php

示例2: render

 /**
  * Renderer for "Action" column in Newsletter templates grid
  *
  * @param \Magento\Framework\Object $row
  * @return string
  */
 public function render(\Magento\Framework\Object $row)
 {
     if ($row->isValidForSend()) {
         $actions[] = ['url' => $this->getUrl('*/queue/edit', ['template_id' => $row->getId()]), 'caption' => __('Queue Newsletter')];
     }
     $actions[] = ['url' => $this->getUrl('*/*/preview', ['id' => $row->getId()]), 'popup' => true, 'caption' => __('Preview')];
     $this->getColumn()->setActions($actions);
     return parent::render($row);
 }
開發者ID:nja78,項目名稱:magento2,代碼行數:15,代碼來源:Action.php

示例3: getEditUrl

 /**
  * Retrieve gift message save url
  *
  * @param \Magento\Framework\Object $item
  * @param string $type
  * @param array $params
  * @return string
  */
 public function getEditUrl(\Magento\Framework\Object $item, $type, $params = array())
 {
     if ($item->getGiftMessageId()) {
         $params = array_merge($params, array('message' => $item->getGiftMessageId(), 'item' => $item->getId(), 'type' => $type));
         return $this->_getUrl('giftmessage/index/edit', $params);
     } else {
         $params = array_merge($params, array('item' => $item->getId(), 'type' => $type));
         return $this->_getUrl('giftmessage/index/new', $params);
     }
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:18,代碼來源:Url.php

示例4: beforeSave

 /**
  * Set new increment id
  *
  * @param \Magento\Framework\Object $object
  * @return $this
  */
 public function beforeSave($object)
 {
     if (!$object->getId()) {
         $this->getAttribute()->getEntity()->setNewIncrementId($object);
     }
     return $this;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:13,代碼來源:Increment.php

示例5: getChildOrderIds

 /**
  * Return recurring payment child Orders Ids
  *
  *
  * @param \Magento\Framework\Object $object
  * @return array
  */
 public function getChildOrderIds($object)
 {
     $adapter = $this->_getReadAdapter();
     $bind = array(':payment_id' => $object->getId());
     $select = $adapter->select()->from(array('main_table' => $this->getTable('recurring_payment_order')), array('order_id'))->where('payment_id=:payment_id');
     return $adapter->fetchCol($select, $bind);
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:14,代碼來源:Payment.php

示例6: render

 /**
  * Render grid column
  *
  * @param \Magento\Framework\Object $row
  * @return string
  */
 public function render(\Magento\Framework\Object $row)
 {
     $actions = [];
     $actions[] = ['url' => $this->getUrl('adminhtml/*/preview', ['id' => $row->getId()]), 'popup' => true, 'caption' => __('Preview')];
     $this->getColumn()->setActions($actions);
     return parent::render($row);
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:13,代碼來源:Action.php

示例7: _setAttributeValue

 /**
  * Set attribute value
  *
  * @param \Magento\Framework\Object $object
  * @return $this
  */
 protected function _setAttributeValue($object)
 {
     $storeId = $object->getStoreId();
     $defaultStoreId = \Magento\Store\Model\Store::DEFAULT_STORE_ID;
     if (!isset($this->_entityAttributeValues[$object->getId()])) {
         return $this;
     }
     $productValues = $this->_entityAttributeValues[$object->getId()];
     if (!isset($productValues[$storeId]) && !isset($productValues[$defaultStoreId])) {
         return $this;
     }
     $value = isset($productValues[$storeId]) ? $productValues[$storeId] : $productValues[$defaultStoreId];
     $value = $this->_prepareDatetimeValue($value, $object);
     $value = $this->_prepareMultiselectValue($value, $object);
     $object->setData($this->getAttribute(), $value);
     return $this;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:23,代碼來源:Product.php

示例8: render

 /**
  * Renders grid column
  *
  * @param   \Magento\Framework\Object $row
  * @return  string
  */
 public function render(\Magento\Framework\Object $row)
 {
     if ($row->getSubscriberStatus() == \Magento\Newsletter\Model\Subscriber::STATUS_SUBSCRIBED) {
         return '<input type="checkbox" name="subscriber[]" value="' . $row->getId() . '" class="subscriberCheckbox"/>';
     } else {
         return '';
     }
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:14,代碼來源:Checkbox.php

示例9: render

 /**
  * Renders column
  *
  * @param \Magento\Framework\Object $row
  * @return string
  */
 public function render(\Magento\Framework\Object $row)
 {
     $actions = [];
     if ($row->getQueueStatus() == \Magento\Newsletter\Model\Queue::STATUS_NEVER) {
         if (!$row->getQueueStartAt() && $row->getSubscribersTotal()) {
             $actions[] = ['url' => $this->getUrl('*/*/start', ['id' => $row->getId()]), 'caption' => __('Start')];
         }
     } elseif ($row->getQueueStatus() == \Magento\Newsletter\Model\Queue::STATUS_SENDING) {
         $actions[] = ['url' => $this->getUrl('*/*/pause', ['id' => $row->getId()]), 'caption' => __('Pause')];
         $actions[] = ['url' => $this->getUrl('*/*/cancel', ['id' => $row->getId()]), 'confirm' => __('Do you really want to cancel the queue?'), 'caption' => __('Cancel')];
     } elseif ($row->getQueueStatus() == \Magento\Newsletter\Model\Queue::STATUS_PAUSE) {
         $actions[] = ['url' => $this->getUrl('*/*/resume', ['id' => $row->getId()]), 'caption' => __('Resume')];
     }
     $actions[] = ['url' => $this->getUrl('*/*/preview', ['id' => $row->getId()]), 'caption' => __('Preview'), 'popup' => true];
     $this->getColumn()->setActions($actions);
     return parent::render($row);
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:23,代碼來源:Action.php

示例10: _afterSave

 /**
  * Set default shipping to address
  *
  * @param \Magento\Framework\Object $address
  * @return $this
  */
 protected function _afterSave(\Magento\Framework\Object $address)
 {
     if ($address->getIsCustomerSaveTransaction()) {
         return $this;
     }
     if ($address->getId() && ($address->getIsDefaultBilling() || $address->getIsDefaultShipping())) {
         $customer = $this->_createCustomer()->load($address->getCustomerId());
         if ($address->getIsDefaultBilling()) {
             $customer->setDefaultBilling($address->getId());
         }
         if ($address->getIsDefaultShipping()) {
             $customer->setDefaultShipping($address->getId());
         }
         $customer->save();
     }
     return $this;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:23,代碼來源:Address.php

示例11: beforeSave

 /**
  * Before save
  *
  * @param \Magento\Framework\Object $object
  * @return $this
  */
 public function beforeSave($object)
 {
     if ($object->getId()) {
         return $this;
     }
     if (!$object->hasData('website_id')) {
         $object->setData('website_id', $this->_storeManager->getStore()->getWebsiteId());
     }
     return $this;
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:16,代碼來源:Website.php

示例12: render

 /**
  * Renders grid column
  *
  * @param   \Magento\Framework\Object $row
  * @return  string
  */
 public function render(\Magento\Framework\Object $row)
 {
     $values = $this->_getValues();
     $value = $row->getData($this->getColumn()->getIndex());
     if (is_array($values)) {
         $checked = in_array($value, $values) ? ' checked="checked"' : '';
     } else {
         $checked = $value === $this->getColumn()->getValue() ? ' checked="checked"' : '';
     }
     $html = '<input type="radio" name="' . $this->getColumn()->getHtmlName() . '" ';
     $html .= 'value="' . $row->getId() . '" class="radio"' . $checked . '/>';
     return $html;
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:19,代碼來源:Radio.php

示例13: beforeSave

 /**
  * Before save
  *
  * @param \Magento\Framework\Object $object
  * @return $this
  */
 public function beforeSave($object)
 {
     if ($object->getId()) {
         return $this;
     }
     if (!$object->hasStoreId()) {
         $object->setStoreId($this->_storeManager->getStore()->getId());
     }
     if (!$object->hasData('created_in')) {
         $object->setData('created_in', $this->_storeManager->getStore($object->getStoreId())->getName());
     }
     return $this;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:19,代碼來源:Store.php

示例14: prepare

 /**
  * Set qty and custom price for quote item
  *
  * @param Item $item
  * @param \Magento\Framework\Object $request
  * @param Product $candidate
  * @return void
  */
 public function prepare(Item $item, Object $request, Product $candidate)
 {
     /**
      * We specify qty after we know about parent (for stock)
      */
     if ($request->getResetCount() && !$candidate->getStickWithinParent() && $item->getId() == $request->getId()) {
         $item->setData(CartItemInterface::KEY_QTY, 0);
     }
     $item->addQty($candidate->getCartQty());
     $customPrice = $request->getCustomPrice();
     if (!empty($customPrice)) {
         $item->setCustomPrice($customPrice);
         $item->setOriginalCustomPrice($customPrice);
     }
 }
開發者ID:nja78,項目名稱:magento2,代碼行數:23,代碼來源:Processor.php

示例15: _toLinkHtml

 /**
  * Render single action as link html
  *
  * @param  array $action
  * @param  \Magento\Framework\Object $row
  * @return string|false
  */
 protected function _toLinkHtml($action, \Magento\Framework\Object $row)
 {
     $product = $row->getProduct();
     if (isset($action['process']) && $action['process'] == 'configurable') {
         if ($product->canConfigure()) {
             $style = '';
             $onClick = sprintf('onclick="return %s.configureItem(%s)"', $action['control_object'], $row->getId());
             return sprintf('<a href="%s" %s %s>%s</a>', $action['url'], $style, $onClick, $action['caption']);
         } else {
             return false;
         }
     } else {
         return parent::_toLinkHtml($action, $row);
     }
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:22,代碼來源:Multiaction.php


注:本文中的Magento\Framework\Object::getId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。