Esempio n. 1
0
 public function __get($key)
 {
     if (substr($key, -7) == 'Service' || substr($key, -3) == 'DAO') {
         return TXFactory::create($key);
     }
     return isset($this->_data[$key]) ? TXString::encode($this->_data[$key]) : null;
 }
Esempio n. 2
0
 private function __construct($id)
 {
     $this->DAO = TXFactory::create('userDAO');
     if ($id !== NULL) {
         $this->_data = $this->DAO->getByPk($id);
         $this->_pk = $id;
     }
 }
Esempio n. 3
0
 /**
  * 获取form字段
  * @param $name
  * @return mixed
  * @throws TXException
  */
 public function __get($name)
 {
     if (substr($name, -7) == 'Service' || substr($name, -3) == 'DAO') {
         return TXFactory::create($name);
     }
     if (!array_key_exists($name, $this->_datas)) {
         throw new TXException(5001, array($name, get_class($this)));
     }
     return $this->_datas[$name];
 }
Esempio n. 4
0
 /**
  * 获取Service|DAO
  * @param $obj
  * @return TXService | TXDAO
  */
 public function __get($obj)
 {
     if (substr($obj, -7) == 'Service' || substr($obj, -3) == 'DAO') {
         return TXFactory::create($obj);
     }
 }
Esempio n. 5
0
 /**
  * 获取单例全局量
  * @param $name
  * @return mixed
  * @throws TXException
  */
 public function __get($name)
 {
     switch ($name) {
         case 'person':
             return Person::get();
         case 'request':
             return TXRequest::getInstance();
         case 'redis':
             return TXRedis::instance();
         case 'memcache':
             return TXMemcache::instance();
         case 'session':
             return TXSession::instance();
         case 'router':
         case 'cache':
             $module = 'TX' . ucfirst($name);
             return TXFactory::create($module);
         default:
             throw new TXException(1006, $name);
     }
 }