本文整理汇总了PHP中WireData::isChanged方法的典型用法代码示例。如果您正苦于以下问题:PHP WireData::isChanged方法的具体用法?PHP WireData::isChanged怎么用?PHP WireData::isChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WireData
的用法示例。
在下文中一共展示了WireData::isChanged方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isChanged
/**
* Has the Page (or optionally one of it's fields) changed since it was loaded?
*
* Assumes that Pages has turned on this Page's change tracking with a call to setTrackChanges().
* Pages that are new (i.e. don't yet exist in the DB) always return true.
*
* @param string $what If specified, only checks the given property for changes rather than the whole page.
* @return bool
*
*/
public function isChanged($what = '')
{
if ($this->isNew()) {
return true;
}
if (parent::isChanged($what)) {
return true;
}
$changed = false;
if ($what) {
$value = $this->get($what);
if (is_object($value) && $value instanceof Wire) {
$changed = $value->isChanged();
}
} else {
foreach ($this->data as $key => $value) {
if (is_object($value) && $value instanceof Wire) {
$changed = $value->isChanged();
}
if ($changed) {
break;
}
}
}
return $changed;
}