From f52cdaa750f1efa8cb76f6d88c9b1dc291f7b328 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Wed, 14 May 2014 17:49:52 +0200 Subject: add JsonSerializable to entities --- db/entityjsonserializer.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 db/entityjsonserializer.php (limited to 'db/entityjsonserializer.php') diff --git a/db/entityjsonserializer.php b/db/entityjsonserializer.php new file mode 100644 index 000000000..7e3357304 --- /dev/null +++ b/db/entityjsonserializer.php @@ -0,0 +1,28 @@ + + * @author Bernhard Posselt + * @copyright Alessandro Cosentino 2012 + * @copyright Bernhard Posselt 2012, 2014 + */ + +namespace OCA\News\Db; + +trait EntityJSONSerializer { + + + public function serializeFields($properties) { + $result = []; + foreach($properties as $property) { + $result[$property] = $this->$property; + } + return $result; + } + + +} \ No newline at end of file -- cgit v1.2.3