Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- abstract class Entity {
- protected $response = array();
- protected $fields;
- protected $table_name;
- abstract function __construct($table_name);
- function __set($name, $value) {
- $this->{$name} = $value;
- }
- function __get($name) {
- if (array_key_exists($name, $this->response)) {
- return $this->response[$name];
- } else if (in_array($name, $this->response)) {
- return null;
- }
- throw new Exception('Undefined object property ' . __CLASS__ . '::' . $name);
- }
- public function fromRepsonse($response) {
- $this->response = $response;
- }
- }
Add Comment
Please, Sign In to add comment