public function __call($sName, $aArgs)
 {
     /**
      * Обработка вызова методов экшена
      */
     if ($this->oAction->ActionCallExists($sName)) {
         array_unshift($aArgs, $sName);
         return call_user_func_array(array($this->oAction, 'ActionCall'), $aArgs);
     }
     return parent::__call($sName, $aArgs);
 }
 /**
  * Ставим хук на вызов неизвестного метода и считаем что хотели вызвать метод какого либо модуля
  * Также производит обработку методов set* и get*
  * @see Engine::_CallModule
  *
  * @param string $sName Имя метода
  * @param array $aArgs Аргументы
  * @return mixed
  */
 public function __call($sName, $aArgs)
 {
     $sType = strtolower(substr($sName, 0, 3));
     if (!strpos($sName, '_') and in_array($sType, array('get', 'set'))) {
         $sKey = func_underscore(substr($sName, 3));
         if ($sType == 'get') {
             if (isset($this->_aData[$sKey])) {
                 return $this->_aData[$sKey];
             } else {
                 if (preg_match('/Entity([^_]+)/', get_class($this), $sModulePrefix)) {
                     $sModulePrefix = func_underscore($sModulePrefix[1]) . '_';
                     if (isset($this->_aData[$sModulePrefix . $sKey])) {
                         return $this->_aData[$sModulePrefix . $sKey];
                     }
                 }
             }
             return null;
         } elseif ($sType == 'set' and array_key_exists(0, $aArgs)) {
             $this->_aData[$sKey] = $aArgs[0];
             return $this;
         }
     } else {
         return parent::__call($sName, $aArgs);
     }
 }
예제 #3
0
 /**
  * Ставим хук на вызов неизвестного метода и считаем что хотели вызвать метод какого либо модуля
  * Также производит обработку методов set* и get*
  * @see Engine::_CallModule
  *
  * @param string $sName Имя метода
  * @param array $aArgs Аргументы
  * @return mixed
  */
 public function __call($sName, $aArgs)
 {
     if (!strpos($sName, '_')) {
         $sType = strtolower(substr($sName, 0, 3));
         if ($sType == 'get' || $sType == 'set') {
             $sKey = F::StrUnderscore(substr($sName, 3));
             if ($sType == 'get') {
                 if ($this->isProp($sKey)) {
                     return $this->getProp($sKey);
                 } else {
                     if (preg_match('/Entity([^_]+)/', get_class($this), $aMatches)) {
                         $sModulePrefix = F::StrUnderscore($aMatches[1]) . '_';
                         if ($this->isProp($sModulePrefix . $sKey)) {
                             return $this->getProp($sModulePrefix . $sKey);
                         }
                     }
                 }
             } elseif ($sType == 'set' && (isset($aArgs[0]) || array_key_exists(0, $aArgs))) {
                 $this->setProp($sKey, $aArgs[0]);
             }
             return null;
         } else {
             return parent::__call($sName, $aArgs);
         }
     }
     return E::getInstance()->_CallModule($sName, $aArgs);
 }