Pwirth has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/318096

Change subject: BSFoundation: Made EntityConfig searializeable
......................................................................

BSFoundation: Made EntityConfig searializeable

Change-Id: Iff2aba5fee9555bcb4fcee1ded09d22b52a35f2e
---
M includes/entityconfigs/EntityConfig.php
1 file changed, 27 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceFoundation 
refs/changes/96/318096/1

diff --git a/includes/entityconfigs/EntityConfig.php 
b/includes/entityconfigs/EntityConfig.php
index 4a4d10d..9cd028e 100644
--- a/includes/entityconfigs/EntityConfig.php
+++ b/includes/entityconfigs/EntityConfig.php
@@ -83,6 +83,33 @@
                return $this->$sMethod();
        }
 
+       /**
+        * Returns a json serializable object
+        * @return stdClass
+        */
+       public function jsonSerialize() {
+               $aConfig = array();
+               foreach( get_class_methods( $this ) as $sMethod ) {
+                       if( strpos($sMethod, 'get_') !== 0 ) {
+                               continue;
+                       }
+                       //remove the get_
+                       $sVarName = substr( $sMethod, 4 );
+                       $aConfig[$sVarName] = $this->$sMethod();
+               }
+               return (object) array_merge(
+                       static::$aDefaults,
+                       $aConfig
+               );
+       }
+
+       /**
+        * @return string - EntityConfig type
+        */
+       public function getType() {
+               return $this->sType;
+       }
+
        abstract protected function addGetterDefaults();
        abstract protected function get_EntityClass();
 

-- 
To view, visit https://gerrit.wikimedia.org/r/318096
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iff2aba5fee9555bcb4fcee1ded09d22b52a35f2e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: Pwirth <wi...@hallowelt.biz>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to