本文整理汇总了PHP中Magento\Framework\Object::dataHasChangedFor方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::dataHasChangedFor方法的具体用法?PHP Object::dataHasChangedFor怎么用?PHP Object::dataHasChangedFor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Object
的用法示例。
在下文中一共展示了Object::dataHasChangedFor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterSave
/**
* Refresh product rewrites
*
* @param \Magento\Framework\Object $object
* @return $this
*/
public function afterSave($object)
{
if ($object->dataHasChangedFor($this->getAttribute()->getName())) {
$this->_catalogUrl->refreshProductRewrites(null, $object, true);
}
return $this;
}
示例2: getUrlPath
/**
* Build category URL path
*
* @param \Magento\Catalog\Api\Data\CategoryInterface|\Magento\Framework\Object $category
* @return string
*/
public function getUrlPath($category)
{
if ($category->getParentId() == Category::TREE_ROOT_ID) {
return '';
}
$path = $category->getUrlPath();
if ($path !== null && !$category->dataHasChangedFor('url_key') && !$category->dataHasChangedFor('parent_id')) {
return $path;
}
$path = $category->getUrlKey();
if ($path === false) {
return $category->getUrlPath();
}
if ($this->isNeedToGenerateUrlPathForParent($category)) {
$parentPath = $this->getUrlPath($this->categoryRepository->get($category->getParentId()));
$path = $parentPath === '' ? $path : $parentPath . '/' . $path;
}
return $path;
}
示例3: testOrigData
/**
* Tests \Magento\Framework\Object->setOrigData()
*/
public function testOrigData()
{
$data = ['key1' => 'value1', 'key2' => 'value2'];
$this->_object->setData($data);
$this->_object->setOrigData();
$this->_object->setData('key1', 'test');
$this->assertTrue($this->_object->dataHasChangedFor('key1'));
$this->assertEquals($data, $this->_object->getOrigData());
$this->_object->setOrigData('key1', 'test');
$this->assertEquals('test', $this->_object->getOrigData('key1'));
}