本文整理汇总了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());
}
示例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());
}
示例3: testIsInRootCategoryList
public function testIsInRootCategoryList()
{
$this->assertFalse($this->_model->isInRootCategoryList());
$this->_model->unsetData();
$this->_model->load(3);
$this->assertTrue($this->_model->isInRootCategoryList());
}
示例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);
}
示例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;
}
示例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;
}
示例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');
}
示例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);
}
}