mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-17 12:28:41 +00:00
Implement json serialize
This commit is contained in:
parent
8550bbda59
commit
2cf6969cfb
|
|
@ -31,7 +31,7 @@ use phpOMS\Validation\Base\Email;
|
|||
* @link http://orange-management.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Account implements ArrayableInterface
|
||||
class Account implements ArrayableInterface, \JsonSerializable
|
||||
{
|
||||
|
||||
/**
|
||||
|
|
@ -468,6 +468,19 @@ class Account implements ArrayableInterface
|
|||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->jsonSerialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Json serialize.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return json_encode($this->toArray());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ use phpOMS\Contract\ArrayableInterface;
|
|||
* @link http://orange-management.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Group implements ArrayableInterface
|
||||
class Group implements ArrayableInterface, \JsonSerializable
|
||||
{
|
||||
|
||||
/**
|
||||
|
|
@ -195,6 +195,19 @@ class Group implements ArrayableInterface
|
|||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->jsonSerialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Json serialize.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return json_encode($this->toArray());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user