Example #1
0
 public static function __callStatic($method, $args)
 {
     $class = __NAMESPACE__ . '\\SlimDb';
     if (method_exists($class, $method)) {
         return call_user_func_array("{$class}::{$method}", $args);
     }
     SlimDb::exception("Invalid static method! ({$method})", __METHOD__);
 }
Example #2
0
 /**
  * Reload object from db
  * 
  * @param mixed $id
  * @return this
  */
 public function load($id)
 {
     if ($id === '') {
         SlimDb::exception("Invalid id value! ({$id})", __METHOD__);
     }
     $data = $this->tableObj->firstById($id)->toArray();
     if ($this->reset($data)) {
         $this->loadedFromDb = true;
     } else {
         $this->__set($this->pkName(), $id);
     }
     return $this;
 }