From: Florent Bruneau Date: Sat, 6 Nov 2010 11:42:46 +0000 (+0100) Subject: Take into account PlExportable interface. X-Git-Tag: core/1.1.2~21 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=3905332ef0d92282716acb1c634d290ac675e756;hp=23749c61b65d441b631e791005277ec1c69f4c83;p=platal.git Take into account PlExportable interface. Signed-off-by: Florent Bruneau --- diff --git a/classes/pldbtableentry.php b/classes/pldbtableentry.php index 466a4ff..bb92f82 100644 --- a/classes/pldbtableentry.php +++ b/classes/pldbtableentry.php @@ -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; }