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


PHP Category::unsetData方法代码示例

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


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

示例1: testGetProductsPosition

 public function testGetProductsPosition()
 {
     $this->assertEquals([], $this->_model->getProductsPosition());
     $this->_model->unsetData();
     $this->_model = $this->getCategoryByName('Category 2');
     $this->assertEquals([], $this->_model->getProductsPosition());
     $this->_model->unsetData();
     $this->_model = $this->getCategoryByName('Category 1.1.1');
     $this->assertNotEmpty($this->_model->getProductsPosition());
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:10,代码来源:CategoryTest.php

示例2: testGetProductsPosition

 public function testGetProductsPosition()
 {
     $this->assertEquals([], $this->_model->getProductsPosition());
     $this->_model->unsetData();
     $this->_model->load(6);
     $this->assertEquals([], $this->_model->getProductsPosition());
     $this->_model->unsetData();
     $this->_model->load(4);
     $this->assertContains(1, $this->_model->getProductsPosition());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:10,代码来源:CategoryTest.php

示例3: testIsInRootCategoryList

 public function testIsInRootCategoryList()
 {
     $this->assertFalse($this->_model->isInRootCategoryList());
     $this->_model->unsetData();
     $this->_model->load(3);
     $this->assertTrue($this->_model->isInRootCategoryList());
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:7,代码来源:CategoryTreeTest.php

示例4: testDeleteChildren

 /**
  * @magentoAppArea adminhtml
  */
 public function testDeleteChildren()
 {
     $this->_model->unsetData();
     $this->_model->load(4);
     $this->_model->setSkipDeleteChildren(true);
     $this->_model->delete();
     $this->_model->unsetData();
     $this->_model->load(5);
     $this->assertEquals($this->_model->getId(), 5);
     $this->_model->unsetData();
     $this->_model->load(3);
     $this->assertEquals($this->_model->getId(), 3);
     $this->_model->delete();
     $this->_model->unsetData();
     $this->_model->load(5);
     $this->assertEquals($this->_model->getId(), null);
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:20,代码来源:CategoryTest.php

示例5: _savePath

 /**
  * Update path field
  *
  * @param \Magento\Catalog\Model\Category $object
  * @return $this
  */
 protected function _savePath($object)
 {
     if ($object->getId()) {
         $this->_getWriteAdapter()->update($this->getEntityTable(), array('path' => $object->getPath()), array('entity_id = ?' => $object->getId()));
         $object->unsetData('path_ids');
     }
     return $this;
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:14,代码来源:Category.php

示例6: _savePath

 /**
  * Update path field
  *
  * @param \Magento\Catalog\Model\Category $object
  * @return $this
  */
 protected function _savePath($object)
 {
     if ($object->getId()) {
         $this->getConnection()->update($this->getEntityTable(), ['path' => $object->getPath()], ['entity_id = ?' => $object->getId()]);
         $object->unsetData('path_ids');
     }
     return $this;
 }
开发者ID:rafaelstz,项目名称:magento2,代码行数:14,代码来源:Category.php

示例7: validateCategory

 /**
  * Validate category process
  *
  * @param  Category $category
  * @return void
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 protected function validateCategory(Category $category)
 {
     $useConfigFields = [];
     foreach ($this->useConfigFields as $field) {
         if (!$category->getData($field)) {
             $useConfigFields[] = $field;
         }
     }
     $category->setData('use_post_data_config', $useConfigFields);
     $validate = $category->validate();
     if ($validate !== true) {
         foreach ($validate as $code => $error) {
             if ($error === true) {
                 $attribute = $this->categoryResource->getAttribute($code)->getFrontend()->getLabel();
                 throw new \Magento\Framework\Exception\LocalizedException(__('Attribute "%1" is required.', $attribute));
             } else {
                 throw new \Magento\Framework\Exception\LocalizedException(__($error));
             }
         }
     }
     $category->unsetData('use_post_data_config');
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:29,代码来源:CategoryRepository.php

示例8: unsetData

 /**
  * {@inheritdoc}
  */
 public function unsetData($key = null)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'unsetData');
     if (!$pluginInfo) {
         return parent::unsetData($key);
     } else {
         return $this->___callPlugins('unsetData', func_get_args(), $pluginInfo);
     }
 }
开发者ID:HaonanXu,项目名称:der-snack-backup,代码行数:12,代码来源:Interceptor.php


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