Skip to content

Commit

Permalink
Tweaking isModified to be clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
pnomolos committed Jun 13, 2012
1 parent 725d5a0 commit 9cade10
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/Spot/Entity.php
Expand Up @@ -175,7 +175,12 @@ public function dataUnmodified($field = null)
}


public function isModified($field = null) {
/**
* Returns true if a field has been modified.
* If no field name is passed in, return whether any fields have been changed
*/
public function isModified($field = null)
{
if (null !== $field) {
if (isset($this->_dataModified[$field])) {
return $this->_dataModified[$field] != $this->_data[$field];
Expand All @@ -185,7 +190,7 @@ public function isModified($field = null) {
return null;
}
}
return !!array_keys($this->_dataModified);
return !!count($this->_dataModified);
}


Expand Down

0 comments on commit 9cade10

Please sign in to comment.