/**
  * Удаляет поведение у текущего объекта
  */
 public function Detach()
 {
     if ($this->oObject) {
         foreach ($this->aHooks as $sName => $mParams) {
             list($aCallback, ) = $this->ParseHookParams($mParams);
             $this->oObject->RemoveBehaviorHook($sName, $aCallback);
         }
         $this->oObject = null;
     }
 }
 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);
 }
 /**
  * Устанавливает список объектов
  *
  * @param $aCollection	Список объектов связи
  */
 public function __construct($aCollection)
 {
     parent::__construct();
     if (!$aCollection) {
         $aCollection = array();
     }
     if (!is_array($aCollection)) {
         $aCollection = array($aCollection);
     }
     foreach ($aCollection as $oEntity) {
         $this->aCollection[$oEntity->_getPrimaryKeyValue()] = $oEntity;
     }
 }
 /**
  * @param string|null $sLockFile Полный путь до лок файла, например <pre>Config::Get('sys.cache.dir').'notify.lock'</pre>
  */
 public function __construct($sLockFile = null)
 {
     parent::__construct();
     $this->sProcessName = get_class($this);
     $oEngine = Engine::getInstance();
     /**
      * Инициализируем ядро
      */
     $oEngine->Init();
     if (!empty($sLockFile)) {
         $this->oLockFile = fopen($sLockFile, 'a');
     }
     /**
      * Инициализируем лог и делает пометку о старте процесса
      */
     $this->Log('Cron process started');
 }
 /**
  * Конструктор
  *
  * @param string $sAction Название экшена
  */
 public function __construct($sAction)
 {
     parent::__construct();
     $this->RegisterEvent();
     $this->sCurrentAction = $sAction;
     $this->aParams = Router::GetParams();
 }
 /**
  * Загрузка конфига роутинга при создании объекта
  */
 public function __construct()
 {
     parent::__construct();
     $this->LoadConfig();
 }
 /**
  * Ставим хук на вызов неизвестного метода и считаем что хотели вызвать метод какого либо модуля
  * Также производит обработку методов 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);
     }
 }
Example #8
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);
 }
 /**
  * При создании блока передаем в него параметры
  *
  * @param array $aParams Список параметров блока
  */
 public function __construct($aParams)
 {
     parent::__construct();
     $this->aParams = $aParams;
 }
 /**
  * Передаем коннект к БД
  *
  * @param DbSimple_Database $oDb
  */
 public function __construct(DbSimple_Database $oDb)
 {
     parent::__construct();
     $this->oDb = $oDb;
 }