Returns a value indicating whether the named attribute has been changed.
public isAttributeChanged ( string $name, boolean $identical = true ) : boolean | ||
$name | string | the name of the attribute. |
$identical | boolean | whether the comparison of new and old value is made for identical values using `===`, defaults to `true`. Otherwise `==` is used for comparison. This parameter is available since version 2.0.4. |
리턴 | boolean | whether the attribute has been changed |
/** * Returns a value indicating whether the named attribute has been changed. * @param string $name the name of the attribute * @return boolean whether the attribute has been changed */ public function isAttributeChanged($name, $depth = 2) { if (is_array($this->getAttribute($name))) { $new = $this->getAttribute($name); $old = $this->getOldAttribute($name); if ($depth < 1) { $depth = 1; } return self::isArrayChanged($new, $old, $depth); } else { return BaseActiveRecord::isAttributeChanged($name); } }