summaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-03-19 21:30:12 +0100
committerBernhard Posselt <nukeawhale@gmail.com>2013-03-19 21:30:12 +0100
commit1d43634ebd97cf67e2ba27f1880cc59b86b29f96 (patch)
tree4324542ccb08fc46b1ff79b194a389737032eb99 /db
parentd96e7946734c88683920d00a28fd901c7a18be66 (diff)
created a protected function to mark a field as updated
Diffstat (limited to 'db')
-rw-r--r--db/entity.php15
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