1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
-
- namespace Luticate\Utils;
-
- abstract class LuDbo implements \JsonSerializable {
- /**
- * @return string
- */
- public function __toString()
- {
- return json_encode($this);
- }
-
- /**
- * @param $newClass LuDbo
- * @return LuDbo
- */
- public function castAs($newClass) {
- $obj = new $newClass;
- foreach (get_object_vars($this) as $key => $name) {
- $obj->$key = $name;
- }
- return $obj;
- }
-
- /**
- * Deserialize from a JSON object
- * @param $json mixed The JSON data to deserialize
- * @return LuDbo
- */
- public static function jsonDeserialize($json)
- {
- return null;
- }
-
- /**
- * Generate a sample JSON object for the DBO
- * @return array
- */
- public static function generateSample()
- {
- return null;
- }
- }
|