当前位置: 首页>>代码示例>>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;未经允许,请勿转载。