Solar_Sql_Model_Record::isChanged()
Tells if the record, or a particular table-column in the record, has changed from its initial value.
Parameters
(string)
$col
: The table-column name; if null,
Returns
(void|bool) Returns null if the table-column name does not exist, boolean true if the data is changed, boolean false if not changed.
Description
Tells if the record, or a particular table-column in the record, has changed from its initial value.
This is slightly complicated. Changes to or from a null are reported as "changed". If both the initial value and new value are numeric (that is, whether they are string/float/int), they are compared using normal inequality (!=). Otherwise, the initial value and new value are compared using strict inequality (!==).
This complexity results from converting string and numeric values in and out of the database. Coming from the database, a string numeric '1' might be filtered to an integer 1 at some point, making it look like the value was changed when in practice it has not.
Similarly, we need to make allowances for nulls, because a non-numeric null is loosely equal to zero or an empty string.