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


PHP AbstractModel::getPath方法代碼示例

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


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

示例1: _checkUnique

 /**
  * Validate unique configuration data before save
  * Set id to object if exists configuration instead of throw exception
  *
  * @SuppressWarnings(PHPMD.CamelCaseMethodName)
  *
  * @param \Magento\Framework\Model\AbstractModel $object The current configuration value being saved
  *
  * @return $this
  */
 protected function _checkUnique(\Magento\Framework\Model\AbstractModel $object)
 {
     $select = $this->getConnection()->select()->from($this->getMainTable(), [$this->getIdFieldName()])->where('scope = :scope')->where('scope_code = :scope_code')->where('path = :path');
     $bind = ['scope' => $object->getScope(), 'scope_code' => $object->getScopeCode(), 'path' => $object->getPath()];
     $configId = $this->getConnection()->fetchOne($select, $bind);
     if ($configId) {
         $object->setId($configId);
     }
     return $this;
 }
開發者ID:smile-sa,項目名稱:elasticsuite,代碼行數:20,代碼來源:Data.php

示例2: _checkUnique

 /**
  * Validate unique configuration data before save
  * Set id to object if exists configuration instead of throw exception
  *
  * @param \Magento\Framework\Model\AbstractModel $object
  * @return $this
  */
 protected function _checkUnique(\Magento\Framework\Model\AbstractModel $object)
 {
     $select = $this->_getReadAdapter()->select()->from($this->getMainTable(), array($this->getIdFieldName()))->where('scope = :scope')->where('scope_id = :scope_id')->where('path = :path');
     $bind = array('scope' => $object->getScope(), 'scope_id' => $object->getScopeId(), 'path' => $object->getPath());
     $configId = $this->_getReadAdapter()->fetchOne($select, $bind);
     if ($configId) {
         $object->setId($configId);
     }
     return $this;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:17,代碼來源:Data.php

示例3: _afterSave

 /**
  * after save callback
  *
  * @param \Magento\Framework\Model\AbstractModel|\Mageplaza\Blog\Model\Category $object
  * @return $this
  */
 protected function _afterSave(\Magento\Framework\Model\AbstractModel $object)
 {
     /** @var \Mageplaza\Blog\Model\Category $object */
     if (substr($object->getPath(), -1) == '/') {
         $object->setPath($object->getPath() . $object->getId());
         $this->savePath($object);
     }
     $this->savePostRelation($object);
     return parent::_afterSave($object);
 }
開發者ID:mageplaza,項目名稱:magento-2-blog-extension,代碼行數:16,代碼來源:Category.php


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