当前位置: 首页>>代码示例>>PHP>>正文


PHP Yii::warning方法代码示例

本文整理汇总了PHP中Yii::warning方法的典型用法代码示例。如果您正苦于以下问题:PHP Yii::warning方法的具体用法?PHP Yii::warning怎么用?PHP Yii::warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Yii的用法示例。


在下文中一共展示了Yii::warning方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: connect

 public function connect(\Closure $callback, array $options = [])
 {
     $options = array_merge(['logging' => $this->logging, 'loggingOutput' => $this->loggingOutput, 'connectionTimeout' => null, 'connectionOptions' => []], $options);
     if (!$options['logging']) {
         Logger::set(new NullLogger());
     }
     if (!$options['loggingOutput']) {
         ob_start();
     }
     $connection = $this->createConnection($options['connectionOptions']);
     $connection->once('open', function (ClientSession $session) use($connection, $callback) {
         call_user_func_array($callback, [$connection, $session]);
     });
     if ($options['connectionTimeout'] !== null) {
         $loop = $connection->getClient()->getLoop();
         $timer = $loop->addTimer($options['connectionTimeout'], function () use($loop) {
             $loop->stop();
         });
         $connection->once('close', function () use($timer) {
             $timer->cancel();
             \Yii::warning('WAMP connection closed by timeout.');
         });
     }
     $connection->open();
     if ($options['logging']) {
         \Yii::info(ob_get_contents());
     }
     if (!$options['loggingOutput']) {
         ob_clean();
     }
 }
开发者ID:filsh,项目名称:yii2-wamp,代码行数:31,代码来源:Router.php

示例2: _run

 protected function _run()
 {
     try {
         $form = null;
         if ($this->form_id) {
             $this->modelForm = Form2Form::find()->where(['id' => $this->form_id])->one();
             if (!$this->modelForm) {
                 throw new ErrorException("Форма не найдена: id=" . $this->form_id);
             }
         } else {
             if ($this->form_code) {
                 $this->modelForm = Form2Form::find()->where(['code' => $this->form_code])->one();
                 if ($form) {
                     $this->form_id = $form->id;
                 }
             }
             if (!$this->modelForm) {
                 throw new ErrorException("Форма не найдена: code=" . $this->form_code);
             }
         }
     } catch (\Exception $e) {
         \Yii::warning($e->getMessage(), static::className());
     }
     if (!$this->modelForm) {
         return "";
     }
     return parent::_run();
 }
开发者ID:skeeks-cms,项目名称:cms-module-form2,代码行数:28,代码来源:FormWidget.php

示例3: run

 /**
  * @param ActionData $actionData
  *
  * @return void
  */
 public function run(&$actionData)
 {
     $monsterContentConfigs = [];
     foreach ($this->entities as $definition) {
         if (!isset($definition['entity'], $definition['attributes'])) {
             continue;
         }
         $entity = $definition['entity'];
         $definition['attributes'] = (array) $definition['attributes'];
         /** @var yii\base\Model $model */
         $models = ArrayHelper::getValue($actionData->entities, $entity, []);
         $model = is_object($models) ? $models : reset($models);
         if ($model === null) {
             Yii::info("Entities list: " . yii\helpers\VarDumper::dumpAsString($actionData->entities));
             Yii::info((array) ArrayHelper::getValue($actionData->entities, $entity, []));
             Yii::info("Searching for " . $entity);
             throw new \RuntimeException("Model is empty");
         }
         foreach ($definition['attributes'] as $index => $attribute) {
             $materials = $model->{$attribute};
             if (is_array($materials) || is_object($materials)) {
                 $monsterContentConfigs[] = ['materials' => $materials, 'uniqueContentId' => $model::className() . ":{$index}:" . $model->id];
             } else {
                 Yii::warning("Model attribute {$attribute} of entity {$entity} is not array or object");
             }
         }
     }
     $content = '';
     foreach ($monsterContentConfigs as $index => $config) {
         $content .= "<!-- MonsterContent::{$index} -->\n" . MonsterContent::widget($config) . "\n\n";
     }
     $actionData->content = $content;
 }
开发者ID:DevGroup-ru,项目名称:dotplant-monster,代码行数:38,代码来源:MaterializedAttributes.php

示例4: process

 /**
  * @param integer $position
  * @param array $files
  */
 protected function process($position, $files)
 {
     $resultFile = sprintf('%s/%s.js', $this->view->minify_path, $this->_getSummaryFilesHash($files));
     if (!file_exists($resultFile)) {
         $js = '';
         foreach ($files as $file => $html) {
             $file = $this->getAbsoluteFilePath($file);
             $content = '';
             if (!file_exists($file)) {
                 \Yii::warning(sprintf('Asset file not found `%s`', $file), __METHOD__);
             } elseif (!is_readable($file)) {
                 \Yii::warning(sprintf('Asset file not readable `%s`', $file), __METHOD__);
             } else {
                 $content .= file_get_contents($file) . ';' . "\n";
             }
             $js .= $content;
         }
         $this->removeJsComments($js);
         if ($this->view->minifyJs) {
             $js = (new \JSMin($js))->min();
         }
         file_put_contents($resultFile, $js);
         if (false !== $this->view->file_mode) {
             @chmod($resultFile, $this->view->file_mode);
         }
     }
     $file = $this->prepareResultFile($resultFile);
     $this->view->jsFiles[$position][$file] = Html::jsFile($file);
 }
开发者ID:rmrevin,项目名称:yii2-minify-view,代码行数:33,代码来源:JS.php

示例5: process

 /**
  * @param string $parentPath
  * @return void
  */
 public function process($parentPath = '')
 {
     $this->loadManifest();
     if ($this->namespace === '' || $this->namespace === null) {
         $this->namespace = 'unknown';
     }
     if (empty($this->name)) {
         $this->name = $this->id;
     }
     if (empty($this->name)) {
         $this->name = basename($this->getFsLocation());
     }
     $this->fullPath = $this->namespace . '.' . $this->id;
     $groupsDirectories = $this->getChildrenDirectories();
     $this->groups = [];
     foreach ($groupsDirectories as $directory) {
         $group = $this->newChild($directory);
         try {
             $group->process($this->fullPath);
             if ($group->id === null) {
                 Yii::error("Group for path {$directory} is in unknown format(no id or bad manifest)" . " - bundle: {$this->id}");
                 unset($group);
                 continue;
             }
             $this->groups[$group->id] = $group;
         } catch (\RuntimeException $e) {
             Yii::warning($e);
         }
     }
 }
开发者ID:DevGroup-ru,项目名称:dotplant-monster,代码行数:34,代码来源:Bundle.php

示例6: actionIndex

 /**
  * Lists all ClientEmployee models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new ClientEmployeeSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     if (isset($_GET['download'])) {
         $datetime_start = str_replace('\'', '', $_GET['datetime_start']);
         $datetime_end = str_replace('\'', '', $_GET['datetime_end']);
         $filename = Yii::$app->getRuntimePath() . "/员工会员推广排行榜-" . $datetime_start . '到' . $datetime_end . '.csv';
         $fh = fopen($filename, 'w');
         fprintf($fh, "排名,会员推广数量,员工姓名,电话,营业厅" . PHP_EOL);
         $i = 1;
         \Yii::warning('yjhu:' . $datetime_start);
         $rows = \app\models\MUser::getMemberPromotionTopList(0, 5000, $datetime_start . ' 00:00:00', $datetime_end . ' 23:59:59');
         foreach ($rows as $row) {
             $staff = \app\models\MStaff::findOne(['scene_id' => $row['scene_pid']]);
             fprintf($fh, $i++ . ',');
             fprintf($fh, $row['members'] . ',');
             fprintf($fh, $staff->name . ',');
             fprintf($fh, $staff->mobile . ',');
             fprintf($fh, (empty($staff->office) ? '' : $staff->office->title) . PHP_EOL);
         }
         fclose($fh);
         Yii::$app->response->sendFile($filename);
         return;
     }
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
开发者ID:noikiy,项目名称:wowewe,代码行数:31,代码来源:ClientEmployeeController.php

示例7: apply

 /**
  * @inheritdoc
  */
 public function apply($model)
 {
     if ($this->isDue() && in_array($model->ClassID, [6, 12])) {
         $userID = $model->contractor->id;
         \Yii::info('Проверка и применение акции "' . self::$name . '"' . "({$this->getModel()->id})" . ' для пользователя ' . Html::a($userID, ['/user/admin/update', 'id' => $userID]), 'info');
         $settings = $this->getModel()->parseSettings();
         if (empty($settings['attributes'])) {
             return false;
         }
         ArrayHelper::multisort($settings['attributes'], 'payment', SORT_DESC);
         $account = $model->contractor->account;
         foreach ($settings['attributes'] as $attributes) {
             $discount = $this->getModel()->getDiscount();
             $discount->setAttributes($attributes);
             if ($model->CashSum >= $discount->payment && $discount->bonus !== null) {
                 \Yii::warning('Применение акции с атрибутами: ' . Json::encode($attributes), 'info');
                 $account->Bonuses = $account->Bonuses + $discount->bonus;
                 $account->ChargedBonuses = $account->ChargedBonuses + $discount->bonus;
                 if ($account->save(false, ['Bonuses', 'ChargedBonuses'])) {
                     $finance = new FinanceRecord();
                     $finance->CashSum = $discount->bonus;
                     $finance->Coins = $discount->bonus;
                     $finance->ClassID = 18;
                     $finance->ContractorID = $model->ContractorID;
                     $finance->Comment = $this->getDescription();
                     return $finance->save();
                 }
             }
         }
     } else {
         //            var_export(in_array($model->ClassID, [6, 12]));
     }
     return false;
 }
开发者ID:just-leo,项目名称:cardgame-serial,代码行数:37,代码来源:BonusDiscount.php

示例8: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = ClientEmployee::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     \Yii::warning('yjhu_debugging: ' . \yii\helpers\Json::encode($params));
     \Yii::warning('yjhu_debugging: ' . \yii\helpers\Json::encode($this));
     $this->load($params);
     \Yii::warning('yjhu_debugging: ' . \yii\helpers\Json::encode($this));
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query = $query->joinWith('organizations');
     $query->andFilterWhere(['employee_id' => $this->employee_id, 'client_id' => $this->client_id]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     $root_org = ClientOrganization::findOne(['organization_id' => $this->organization_id]);
     if (empty($root_org)) {
         $this->organization_id = 1;
         $root_org = ClientOrganization::findOne(['organization_id' => 1]);
     }
     $query->andFilterWhere(['client_organization.organization_id' => $root_org->getSubordinateIdArray()]);
     if (!empty($this->search_keyword)) {
         $query->leftJoin('client_employee_mobile', 'client_employee_mobile.employee_id = client_employee.employee_id');
         $query->andFilterWhere(['like', 'name', $this->search_keyword]);
         $query->orFilterWhere(['like', 'client_employee_mobile.mobile', $this->search_keyword]);
     }
     return $dataProvider;
 }
开发者ID:noikiy,项目名称:wowewe,代码行数:36,代码来源:ClientEmployeeSearch.php

示例9: saveCopy

 /** @inheritdoc */
 public function saveCopy(callable $callback, $body = true)
 {
     $tos = $this->getTo();
     $froms = $this->getFrom();
     $to = empty($tos) ? null : array_keys($tos);
     $from = empty($froms) ? null : array_keys($froms);
     $inserted = $callback($this->getId(), $to[0], $from[0], $this->getSubject(), $body ? $this->getContent() : null, $this->mailer->getService());
     if ($inserted === 0) {
         \Yii::warning("Can not insert email copy of [{$this->getSubject()}|{$to}]");
     }
 }
开发者ID:sjoorm,项目名称:yii2-mailer,代码行数:12,代码来源:SwiftMessage.php

示例10: init

 /**
  * Initializing XHProf
  */
 public function init()
 {
     if (extension_loaded('xhprof')) {
         parent::init();
         require_once $this->includeLibrary;
         require_once $this->includeRuns;
         xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
         $this->isInitialized = true;
     } else {
         \Yii::warning('PHP extension [xhprof] was not loaded.', 'XHProf');
     }
 }
开发者ID:sjoorm,项目名称:yii2-xhprof,代码行数:15,代码来源:XHProf.php

示例11: afterDelete

 /**
  * (non-PHPdoc)
  * @see \yii\db\BaseActiveRecord::afterDelete()
  */
 public function afterDelete()
 {
     $filename_utf8 = \Yii::$app->mycfg->library->directory . $this->filename;
     $filename_encoded = \Yii::$app->mycfg->Encode($filename_utf8);
     if (\Yii::$app->mycfg->library->sync) {
         if (!file_exists($filename_encoded)) {
             \Yii::warning("file '{$filename_utf8}' was removed before record deletion with sync enabled");
         } else {
             unlink($filename_encoded);
         }
     }
     parent::afterDelete();
 }
开发者ID:aekkapun,项目名称:yii2-mylib,代码行数:17,代码来源:Books.php

示例12: process

 /**
  * @param array $files
  */
 protected function process(array $files)
 {
     $resultFile = $this->view->minify_path . DIRECTORY_SEPARATOR . $this->_getSummaryFilesHash($files) . '.css';
     if (!file_exists($resultFile)) {
         $css = '';
         foreach ($files as $file => $html) {
             $path = dirname($file);
             $file = $this->getAbsoluteFilePath($file);
             $content = '';
             if (!file_exists($file)) {
                 \Yii::warning(sprintf('Asset file not found `%s`', $file), __METHOD__);
             } elseif (!is_readable($file)) {
                 \Yii::warning(sprintf('Asset file not readable `%s`', $file), __METHOD__);
             } else {
                 $content = file_get_contents($file);
             }
             $result = [];
             preg_match_all('|url\\(([^)]+)\\)|is', $content, $m);
             if (!empty($m[0])) {
                 foreach ($m[0] as $k => $v) {
                     if (in_array(strpos($m[1][$k], 'data:'), [0, 1], true)) {
                         continue;
                     }
                     $url = str_replace(['\'', '"'], '', $m[1][$k]);
                     if ($this->isUrl($url)) {
                         $result[$m[1][$k]] = $url;
                     } else {
                         $result[$m[1][$k]] = $path . '/' . $url;
                     }
                 }
                 $content = strtr($content, $result);
             }
             $css .= $content;
         }
         $this->expandImports($css);
         $this->removeCssComments($css);
         if ($this->view->minifyCss) {
             $css = (new \CSSmin())->run($css, $this->view->css_linebreak_pos);
         }
         $charsets = false !== $this->view->force_charset ? '@charset "' . (string) $this->view->force_charset . '";' . "\n" : $this->collectCharsets($css);
         $imports = $this->collectImports($css);
         $fonts = $this->collectFonts($css);
         file_put_contents($resultFile, $charsets . $imports . $fonts . $css);
         if (false !== $this->view->file_mode) {
             @chmod($resultFile, $this->view->file_mode);
         }
     }
     $file = $this->prepareResultFile($resultFile);
     $this->view->cssFiles[$file] = Html::cssFile($file);
 }
开发者ID:rmrevin,项目名称:yii2-minify-view,代码行数:53,代码来源:CSS.php

示例13: log

 /**
  * @param string $level
  * @param string $msg
  */
 public function log($level, $msg)
 {
     switch ($level) {
         default:
         case 'INFO':
             \Yii::info($msg, static::LOG_CATEGORY);
             break;
         case 'WARNING':
             \Yii::warning($msg, static::LOG_CATEGORY);
             break;
         case 'ERROR':
             \Yii::error($msg, static::LOG_CATEGORY);
             break;
     }
 }
开发者ID:rmrevin,项目名称:yii2-rollbar,代码行数:19,代码来源:Logger.php

示例14: beforeValidate

 public function beforeValidate()
 {
     try {
         if ($this->isNewRecord && empty($this->created_at)) {
             $this->created_at = self::createDateTime();
         } else {
             if (!$this->isNewRecord) {
                 $this->updated_at = self::createDateTime();
             }
         }
     } catch (\Exception $e) {
         \Yii::warning($e->getMessage(), __METHOD__);
     }
     return parent::beforeValidate();
 }
开发者ID:gofmanaa,项目名称:yii2-notification,代码行数:15,代码来源:Notification.php

示例15: GetSearch

 public function GetSearch($search_string)
 {
     try {
         $result = $this->client->GetSearch(['KEY1' => $this->key1, 'KEY2' => $this->key2, 'TEXT' => $search_string]);
     } catch (\SoapFault $exception) {
         \Yii::warning($exception->getMessage(), 'rossko_api');
         return false;
     } catch (\Exception $e) {
         \Yii::warning($e->getMessage(), 'rossko_api');
         return false;
     }
     if ($result->SearchResults->SearchResult->Success) {
         return $result->SearchResults->SearchResult->PartsList->Part;
     } else {
         return false;
     }
 }
开发者ID:debrsky,项目名称:parts-rpc,代码行数:17,代码来源:RosskoRpcServiceClient.php


注:本文中的Yii::warning方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。