/** * Uses the static method approach if our DI var is null * * @return Object * @author Dan Cox */ public function __get($service) { if (is_null($this->DI)) { return DI::get($service); } return $this->DI->get($service); }
/** * Returns a database object loaded with the model name * * @return Database * @author Dan Cox */ public static function db() { $entity = get_called_class(); $db = DI::get('database'); $db->setModel($entity); return $db; }