Take into account PlExportable interface.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 6 Nov 2010 11:42:46 +0000 (12:42 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 6 Nov 2010 11:42:46 +0000 (12:42 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/pldbtableentry.php

index 466a4ff..bb92f82 100644 (file)
@@ -223,7 +223,11 @@ class JSonFieldFormatter implements PlDBTableFieldFormatter, ArrayAccess
         if (is_string($data)) {
             $this->data = json_decode($data, true);
         } else if (is_object($data)) {
-            $this->data = json_decode(json_encode($data), true);
+            if ($data instanceof PlExportable) {
+                $this->data = $data->export();
+            } else {
+                $this->data = json_decode(json_encode($data), true);
+            }
         } else if (is_array($data)) {
             $this->data = $data;
         }