Пример #1
0
 /**
  *
  * @param \yii\base\Application $app
  * @param array                 $config
  */
 protected function initialize($app, $config)
 {
     if ($app instanceof \yii\web\Application) {
         $app->attachBehaviors([PriceHook::className() => PriceHook::className(), StockHook::className() => StockHook::className()]);
         if (ArrayHelper::getValue($config, 'attach_user_behavior', true)) {
             $this->attachUserProperty($app->getUser());
         }
     }
 }
Пример #2
0
 /**
  * Initialize application before process request
  * @param \yii\base\Application $app
  */
 public function bootstrap($app)
 {
     $definitions = (require __DIR__ . '/definitions.php');
     foreach ($definitions as $name => $definition) {
         Yii::$container->set($name, $definition);
     }
     $hooks = (require __DIR__ . '/hooks.php');
     $app->attachBehaviors(array_combine($hooks, $hooks));
 }
Пример #3
0
 /**
  *
  * @param \yii\base\Application $app
  */
 public function bootstrap($app)
 {
     $app->attachBehaviors([GlHook::className() => GlHook::className(), InvoiceHook::className() => InvoiceHook::className()]);
 }
Пример #4
0
 /**
  * 
  * @param \yii\base\Application $app
  */
 public function bootstrap($app)
 {
     $app->attachBehaviors([CogsHook::className(), PriceHook::className(), StockHook::className()]);
 }