示例#1
0
 /**
  * Get value from System_status model
  *
  * @param string $key
  *
  * @return mixed
  */
 protected function getFromSystemSettingModel($key, \Closure $transformer = null)
 {
     if (!isset($this->properties[$key])) {
         $value = $this->systemSettingModel->getData($key);
         if ($transformer) {
             $value = $transformer($value);
         }
         $this->properties[$key] = $value;
     }
     return $this->properties[$key];
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function __construct($id = null)
 {
     $trace = debug_backtrace();
     if ((empty($trace[2]['object']) || !$trace[2]['object'] instanceof DataMapper) && self::$isInstantiated) {
         throw new RuntimeException('System_setting can be instantiated only once!');
     }
     if ($this->hasTable($this->prefix . $this->table)) {
         parent::__construct($id);
     }
     self::$isInstantiated = true;
 }