Skip to content

Commit

Permalink
Implement JSON serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
vrana committed Jan 10, 2013
1 parent 61a5f81 commit bd5db46
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions NotORM/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -752,4 +752,11 @@ function offsetUnset($key) {
unset($this->data[$key]);
}

// JsonSerializable implementation (not explicit as it is available only since PHP 5.4)

function jsonSerialize() {
$this->execute();
return $this->data;
}

}
6 changes: 6 additions & 0 deletions NotORM/Row.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,10 @@ function offsetUnset($key) {
unset($this->modified[$key]);
}

// JsonSerializable implementation (not explicit as it is available only since PHP 5.4)

function jsonSerialize() {
return $this->row;
}

}

0 comments on commit bd5db46

Please sign in to comment.