当前位置: 首页>>代码示例>>PHP>>正文


PHP AbstractModel::getCustomerId方法代码示例

本文整理汇总了PHP中Magento\Framework\Model\AbstractModel::getCustomerId方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractModel::getCustomerId方法的具体用法?PHP AbstractModel::getCustomerId怎么用?PHP AbstractModel::getCustomerId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\Model\AbstractModel的用法示例。


在下文中一共展示了AbstractModel::getCustomerId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _getAlertRow

 /**
  * Retrieve alert row by object parameters
  *
  * @param \Magento\Framework\Model\AbstractModel $object
  * @return array|false
  */
 protected function _getAlertRow(\Magento\Framework\Model\AbstractModel $object)
 {
     $adapter = $this->_getReadAdapter();
     if ($object->getCustomerId() && $object->getProductId() && $object->getWebsiteId()) {
         $select = $adapter->select()->from($this->getMainTable())->where('customer_id = :customer_id')->where('product_id  = :product_id')->where('website_id  = :website_id');
         $bind = [':customer_id' => $object->getCustomerId(), ':product_id' => $object->getProductId(), ':website_id' => $object->getWebsiteId()];
         return $adapter->fetchRow($select, $bind);
     }
     return false;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:16,代码来源:AbstractResource.php

示例2: _beforeSave

 /**
  * Before save action
  *
  * @param \Magento\Framework\Model\AbstractModel $object
  * @return $this
  */
 protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
 {
     if (is_null($object->getId()) && $object->getCustomerId() && $object->getProductId() && $object->getWebsiteId()) {
         if ($row = $this->_getAlertRow($object)) {
             $object->addData($row);
             $object->setStatus(0);
         }
     }
     if (is_null($object->getAddDate())) {
         $object->setAddDate($this->_dateFactory->create()->gmtDate());
         $object->setStatus(0);
     }
     return parent::_beforeSave($object);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:20,代码来源:Stock.php

示例3: _afterSave

 /**
  * Perform actions after object save
  *
  * @param \Magento\Framework\Model\AbstractModel $object
  * @return $this
  */
 protected function _afterSave(AbstractModel $object)
 {
     $adapter = $this->_getWriteAdapter();
     /**
      * save detail
      */
     $detail = ['title' => $object->getTitle(), 'detail' => $object->getDetail(), 'nickname' => $object->getNickname()];
     $select = $adapter->select()->from($this->_reviewDetailTable, 'detail_id')->where('review_id = :review_id');
     $detailId = $adapter->fetchOne($select, [':review_id' => $object->getId()]);
     if ($detailId) {
         $condition = ["detail_id = ?" => $detailId];
         $adapter->update($this->_reviewDetailTable, $detail, $condition);
     } else {
         $detail['store_id'] = $object->getStoreId();
         $detail['customer_id'] = $object->getCustomerId();
         $detail['review_id'] = $object->getId();
         $adapter->insert($this->_reviewDetailTable, $detail);
     }
     /**
      * save stores
      */
     $stores = $object->getStores();
     if (!empty($stores)) {
         $condition = ['review_id = ?' => $object->getId()];
         $adapter->delete($this->_reviewStoreTable, $condition);
         $insertedStoreIds = [];
         foreach ($stores as $storeId) {
             if (in_array($storeId, $insertedStoreIds)) {
                 continue;
             }
             $insertedStoreIds[] = $storeId;
             $storeInsert = ['store_id' => $storeId, 'review_id' => $object->getId()];
             $adapter->insert($this->_reviewStoreTable, $storeInsert);
         }
     }
     // reaggregate ratings, that depend on this review
     $this->_aggregateRatings($this->_loadVotedRatingIds($object->getId()), $object->getEntityPkValue());
     return $this;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:45,代码来源:Review.php

示例4: _prepareDataForSave

 /**
  * Prepare data for save
  *
  * @param \Magento\Framework\Model\AbstractModel $visitor
  * @return array
  */
 protected function _prepareDataForSave(\Magento\Framework\Model\AbstractModel $visitor)
 {
     return ['customer_id' => $visitor->getCustomerId(), 'session_id' => $visitor->getSessionId(), 'last_visit_at' => $visitor->getLastVisitAt()];
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:10,代码来源:Visitor.php


注:本文中的Magento\Framework\Model\AbstractModel::getCustomerId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。