Example #1
1
 /**
  * Overriding parent
  *
  * @param string $name
  * @return mixed
  */
 public function __get($name)
 {
     // View
     if ($name == 'view') {
         return $this->_controllerInstance->getView();
     }
     // Request
     if ($name == 'request') {
         return $this->_controllerInstance->getRequest();
     }
     // Response
     if ($name == 'response') {
         return $this->_controllerInstance->getResponse();
     }
     // POST
     if ($name == 'post') {
         return $this->_controllerInstance->getRequest()->getPost();
     }
     // GET
     if ($name == 'query') {
         return $this->_controllerInstance->getRequest()->getQuery();
     }
     // URL parameters
     if ($name == 'params') {
         return $this->_controllerInstance->getRequest()->getParams();
     }
     // application env
     if ($name == 'appEnv') {
         return $this->_controllerInstance->getAppEnv();
     }
     parent::__get($name);
 }
Example #2
0
 /**
  * Overloading parent.
  * 
  * If it starts with the beginning of the parameter values ​​"selectBy",
  * Execute SELECT statement and return rows inforamtion
  * by specifying a value for the field was extracted from the subsequent part.
  *
  * If it starts with the beginning of the parameter values ​​"findBy",
  * Execute SELECT statement and return single row information
  * by specifying a value for the field was extracted from the subsequent part.
  * 
  * @return array
  */
 public function __call($name, $args)
 {
     $snake = NameManager::convertToSnake($name);
     if (substr($snake, 0, 10) == 'select_by_') {
         $methodField = substr($snake, 10);
         $rows = $this->_selectByMethodName($methodField, $args);
         return $rows;
     }
     if (substr($snake, 0, 8) == 'find_by_') {
         $methodField = substr($snake, 8);
         $row = $this->_findByMethodName($methodField, $args);
         return $row;
     }
     parent::__call($name, $args);
 }
Example #3
0
 /**
  * Overriding parent
  *
  * @param string $name
  * @return mixed
  */
 public function __get($name)
 {
     if ($name == 'session') {
         if ($this->_session === null) {
             $req = $this->request;
             Loader::load('Session', 'core');
             $ns = $req->getController();
             $subdir = str_replace('/', '_', $req->getControllerSubDirectory());
             if ($subdir != '') {
                 $ns = $subdir . '_' . $ns;
             }
             $this->_session = new Session($ns);
         }
         return $this->_session;
     }
     if ($name == 'post') {
         if (!array_key_exists($name, $this->_caches)) {
             $this->_caches[$name] = $this->request->getPost();
         }
         return $this->_caches[$name];
     }
     if ($name == 'query') {
         if (!array_key_exists($name, $this->_caches)) {
             $this->_caches[$name] = $this->request->getQuery();
         }
         return $this->_caches[$name];
     }
     if ($name == 'params') {
         if (!array_key_exists($name, $this->_caches)) {
             $this->_caches[$name] = $this->request->getParams();
         }
         return $this->_caches[$name];
     }
     if ($name == 'controller') {
         if (!array_key_exists($name, $this->_caches)) {
             $this->_caches[$name] = $this->request->getController();
         }
         return $this->_caches[$name];
     }
     if ($name == 'action') {
         if (!array_key_exists($name, $this->_caches)) {
             $this->_caches[$name] = $this->request->getAction();
         }
         return $this->_caches[$name];
     }
     return parent::__get($name);
 }