Jsonable interface

From: Date: Tue, 18 May 2010 21:04:51 +0000
Subject: Jsonable interface
Groups: php.internals 
Request: Send a blank email to internals+get-48324@lists.php.net to get a copy of this message
If php have annotations feature its be very simple. class MyClass implements Jsonable { private $name; private $age; Transient private $dtCreated;// or JsonIgnore or JsonTransient } all properties will be encoded, except transient. Otherwise,php can have jasonable interface and class that implements it, by default encode all properties(private,default,public,protected), except properties in the __jsonTransient. class MyClass implements Jsonable { private $name; private $age; private $id; public function __jsonTransient() { return array('id'); } } -- Mathias Grimm Sun Certified Java Programmer 6.0 #SUN604760 Zend Certified Engineer #ZEND006756 http://mathiasgrimm.com.br http://phpempregos.com.br

« previous php.internals (#48324) next »