function encodeData() { $c = new GBComment(); $c->comments = $this->data; $it = new GBCommentsIterator($c); foreach ($it as $k => $comment) { if (is_object($comment->date)) { $comment->date = strval($comment->date); } } parent::encodeData(); }