/** * Set model properties within the changed data array, * so that they can be saved later. * * @param string $key The property to set * @param mixed $value The value to set * * @return mixed The new value */ public function __set($key, $value) { // Check that the field being updated is an actual database field if ($this->table->hasField($key)) { // Remember the old value $this->originalData[$key] = $this->data[$key]; } return $this->data[$key] = $value; }