Code cleaup

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Haertl
2017-02-28 14:52:15 +01:00
committed by Julius Härtl
parent 2b05227f4b
commit 1e9c86e158
7 changed files with 58 additions and 39 deletions

View File

@@ -21,17 +21,11 @@
*
*/
/**
* Created by PhpStorm.
* User: jus
* Date: 27.02.17
* Time: 14:05
*/
namespace OCA\Deck\Db;
class RelationalObject implements \JsonSerializable {
abstract class RelationalObject implements \JsonSerializable {
private $primaryKey;
/**
* RelationalObject constructor.
@@ -51,11 +45,15 @@ abstract class RelationalObject implements \JsonSerializable {
);
}
/**
* This method should be overwritten if object doesn't implement \JsonSerializable
*/
public function getObjectSerialization() {
$this->object->jsonSerialize();
if($this->object instanceof \JsonSerializable) {
$this->object->jsonSerialize();
} else {
throw new \Exception('jsonSerialize is not implemented on ' . get_class($this));
}
}
public function getPrimaryKey() {
return $this->getPrimaryKey();
}
}