diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/entity.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/db/entity.php b/db/entity.php index 1adf9b518..2c6f4f899 100644 --- a/db/entity.php +++ b/db/entity.php @@ -45,11 +45,9 @@ abstract class Entity { if(strpos($methodName, 'set') === 0){ $setterPart = substr($methodName, 3); $attr = lcfirst($setterPart); - - // mark as accessed - array_push($this->updatedFields, $attr); - $this->$attr = $args[0]; + $this->markFieldUpdated($attr); + $this->$attr = $args[0]; } elseif(strpos($methodName, 'get') === 0) { $getterPart = substr($methodName, 3); $attr = lcfirst($getterPart); @@ -59,6 +57,15 @@ abstract class Entity { /** + * Mark am attribute as updated + * @param string $attribute the name of the attribute + */ + protected function markFieldUpdated($attribute){ + array_push($this->updatedFields, $attribute); + } + + + /** * Transform a database columnname to a property * @param string $columnName the name of the column * @return string the property name |