當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。