Skip to content

Commit

Permalink
Make ORM be JsonSerializable
Browse files Browse the repository at this point in the history
  • Loading branch information
jimwins committed Feb 23, 2022
1 parent 0e24cc1 commit 3adb19d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
ChangeLog
---------

#### 0.0.4 - release 2022-02-23

* Make ORM be JsonSerializable

#### 0.0.3 - release 2020-06-22

* Make ResultSet be JsonSerializable
Expand Down
11 changes: 10 additions & 1 deletion src/ORM.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
* @method bool isNew()
*/

class ORM implements \ArrayAccess {
class ORM implements \ArrayAccess, \JsonSerializable {

// ----------------------- //
// --- CLASS CONSTANTS --- //
Expand Down Expand Up @@ -2202,6 +2202,15 @@ public function offsetUnset($key) {
unset($this->_dirty_fields[$key]);
}

// --------------------- //
// - JsonSerializable - //
// --------------------- //

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


// --------------------- //
// --- MAGIC METHODS --- //
// --------------------- //
Expand Down

0 comments on commit 3adb19d

Please sign in to comment.