本文整理匯總了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'));
}