function myVarDump($param) { echo '<pre>'; \yii\helpers\VarDumper::dump($param); echo '</pre>'; die; }
/** * @inheritdoc */ public static function dump($var, $exit = 1, $depth = 10, $highlight = true) { parent::dump($var, $depth, $highlight); if ($exit) { exit; } }
public function actionCookie() { // Yii::$app->response->format = Response::FORMAT_RAW; // $headers = Yii::$app->response->headers; // $headers->add('Content-type', 'image/gif'); // $headers->add('Content-Length', '42'); // $headers->add('Cache-Control', 'private, no-cache, no-cache=Set-Cookie, proxy-revalidate'); // $headers->add('Expires', 'Wed, 11 Jan 2000 12:59:00 GMT'); // $headers->add('Last-Modified', 'Wed, 11 Jan 2006 12:59:00 GMT'); // $headers->add('Pragma', 'no-cache'); // echo sprintf('%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%', 71, 73, 70, 56, 57, 97, 1, 0, 1, 0, 128, 255, 0, 192, 192, 192, 0, 0, 0, 33, 249, 4, 1, 0, 0, 0, 0, 44, 0, 0, 0, 0, 1, 0, 1, 0, 0, 2, 2, 68, 1, 0, 59); $clientCookie = new ClientCookie(); if ($clientCookie->cookie_id === null) { $cookie = new Cookie(); $cookie->last_activity = $cookie->create_time = date('Y-m-d H:i:s'); $cookie->save(); $clientCookie->cookie_id = $cookie->id; } else { $cookie = Cookie::findOne(['id' => $clientCookie->cookie_id]); if ($cookie !== null) { $cookie->last_activity = date('Y-m-d H:i:s'); $cookie->save(); } } // $clientCookie->updateCategory(3, [ // 'value' => 1 // ]); $clientCookie->save(); echo "<pre>"; VarDumper::dump($clientCookie); echo "</pre>"; }
public function testDumpObject() { $obj = new \StdClass(); ob_start(); VarDumper::dump($obj); $this->assertEquals("stdClass#1\n(\n)", ob_get_contents()); ob_end_clean(); }
/** * Resets password. * * @return boolean if password was reset. */ public function resetPassword() { $user = $this->_user; VarDumper::dump($user); $user->setPassword($this->password); $user->removePasswordResetToken(); return $user->save(false); }
public function yii($v, $stop = false, $depth = 100) { echo '<pre style="' . $this->getStyle() . '">'; YiiVarDumper::dump($v, $depth, true); echo '</pre>'; if ($stop) { exit; } }
function D($object, $exit = false) { VarDumper::dump($object, 20, 1); echo '<br />'; if ($exit) { exit; } return null; }
public function kepco_suc_detail($job) { echo $job->workload(), PHP_EOL; $workload = Json::decode($job->workload()); $httpClient = new \GuzzleHttp\Client(['base_uri' => 'http://203.248.44.161', 'cookies' => true, 'headers' => ['User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko', 'Content-Type' => 'application/json', 'X-Requested-With' => 'XMLHttpRequest', 'Accept-Language' => 'ko', 'Accept-Encoding' => 'gzip, deflate', 'DNT' => '1', 'Pragma' => 'no-cache', 'Connection' => 'Keep-Alive', 'Accept' => '*/*', 'Referer' => 'http://203.248.44.161/mdi.do?theme=default', 'X-CSRF-TOKEN' => $this->csrf_token, 'Cookie' => $this->cookie]]); $response = $httpClient->request('POST', '/router', ['json' => [['action' => 'smartsuit.ui.etnajs.pro.rfx.sp.OpenInfoDataDetailController', 'method' => 'findOpenInfoDataAttendGrid', 'tid' => 118, 'type' => 'rpc', 'data' => [$workload['id']]], ['action' => 'smartsuit.ui.etnajs.pro.rfx.sp.OpenInfoDataDetailController', 'method' => 'findProposalEvalOpenYn', 'tid' => 119, 'type' => 'rpc', 'data' => [$workload['id']]]]]); $body = $response->getBody(); $json = Json::decode($body); VarDumper::dump($json); }
/** * Debug function * d($var); * @param $var * @param null $caller */ function d($var, $caller = null) { if (!isset($caller)) { $tmp_var = debug_backtrace(1); $caller = array_shift($tmp_var); } echo '<code>File: ' . $caller['file'] . ' / Line: ' . $caller['line'] . '</code>'; echo '<pre>'; VarDumper::dump($var, 10, true); echo '</pre>'; }
/** * Dump and die - Dump as many variables as you want. Infinite parameters. */ function dd() { $args = func_get_args(); foreach ($args as $k => $arg) { echo '<fieldset class="debug"> <legend>' . ($k + 1) . '</legend>'; VarDumper::dump($arg, 10, true); echo '</fieldset>'; } die; }
/** * var_dump() wrapper with autoexit * * @param $var * @param bool $isExit * @param bool $asString * @param int $depth * @return string */ public static function dump($var, $isExit = true, $asString = false, $depth = 3) { if ($asString) { return VarDumper::dumpAsString($var, $depth, true); } else { VarDumper::dump($var, $depth, true); } if ($isExit) { exit; } }
public function actionAddExam() { $model = new \common\models\ExamForm(); if ($model->load(\Yii::$app->request->post()) && $model->validate()) { \yii\helpers\VarDumper::dump(\Yii::$app->request->post(), 10, true); die; $model->addExam(); \Yii::$app->session->setFlash('success', 'Exam Added Successfully'); return $this->redirect(['/exam']); } return $this->render('add-exam', ['model' => $model]); }
/** * Manage the timeouts of the StateMachines */ public function actionTimeouts() { /** @var SmTimeout[] $timeouts */ $timeouts = SmTimeout::find()->andWhere(['<=', 'expires_at', new Expression('NOW()')])->all(); foreach ($timeouts as $timeout) { $context = $timeout->transition(); if ($context->hasException()) { // Handle timeout transition failure VarDumper::dump($context->getFirstException(), 10); } } }
public function actionCommit() { if ($transaction = Transaction::getFromSession()) { \yii\helpers\VarDumper::dump($transaction, 11, 1); $transaction->setOrgId($this->organization->id); if ($transaction->commit()) { return $this->render('transaction_success', []); } else { return $this->render('transaction_error', []); } } return $this->redirect('/transactions'); }
/** * 打印输出 * @param type $var * @param type $depth * @param type $highlight * @param type $isDie */ public static function dump($var, $depth = 10, $highlight = true, $isDie = true) { if ($highlight) { parent::dump($var, $depth, $highlight); } else { echo '<pre>'; parent::dump($var, $depth, $highlight); echo '</pre>'; } if ($isDie === true) { die; } }
public static function dump($value, $depth = 10, $highlight = true) { Yii::$app->response->charset = 'utf-8'; Yii::$app->response->send(); \yii\helpers\VarDumper::dump($value, $depth, $highlight); $c = 1; echo "\r\n"; echo '<pre>'; foreach (debug_backtrace(2) as $item) { echo '#' . $c . ' ' . ArrayHelper::getValue($item, 'file', '') . ':' . ArrayHelper::getValue($item, 'line', '') . ' ' . ArrayHelper::getValue($item, 'class', '') . ArrayHelper::getValue($item, 'type', '') . ArrayHelper::getValue($item, 'function', '') . "\n"; $c++; } echo '</pre>'; exit; }
/** * @throws yii\web\ServerErrorHttpException */ public function init() { parent::init(); \yii\helpers\VarDumper::dump(['modelname' => $this->modelName], 10, true); \Yii::$app->end(); if (null === $this->modelName) { throw new yii\web\ServerErrorHttpException('Model name should be set in controller actions'); } if (!is_subclass_of($this->modelName, '\\yii\\db\\ActiveRecord')) { throw new yii\web\ServerErrorHttpException('Model class does not exists'); } $this->objectId = Object::getForClass($this->modelName); if (null === $this->objectId) { throw new yii\web\ServerErrorHttpException('Object does not exists for model.'); } }
public function syncRemote() { //Make Connection - Ensure that Connection Parameters exist if (!isset($this->uid)) { throw new \yii\base\InvalidConfigException("Model UID must be set for remote synchronisation"); } $raw = (new Viajero())->get('cities', ['query' => ['uid' => $this->uid]])->getBody(); $formatted = Json::decode($raw, true); if (count($formatted == 1)) { $data = $formatted[0]; $this->local_name = $data['name']; $this->language_id = $data['language']; if (!$this->save()) { \yii\helpers\VarDumper::dump($this->errors); } } }
/** * Получение фич по категории. Выбираются только те фичи, у которых есть * актуальные значения в существующих объявлениях * @param int $category_id * @return array */ public static function getByCategoryIdWithValues($category_id) { $sql = 'SELECT f.id, f.name, f.feature_type ' . ' FROM ' . self::tableName() . ' f ' . ' JOIN ' . FeaturesCatergories::tableName() . ' fc ' . ' ON f.id = fc.feature_id ' . ' WHERE fc.category_id = :category_id'; $features = self::findBySql($sql, [':category_id' => $category_id])->indexBy('id')->asArray()->all(); $possible_values = FeaturesValues::getPossibleMarketsValues($category_id, array_keys($features)); foreach ($possible_values as $value) { $features[$value['feature_id']]['values'][] = $value; } $features_with_values = []; foreach ($features as $feature) { if (isset($feature['values'])) { $features_with_values[] = $feature; } } \yii\helpers\VarDumper::dump($features_with_values, 11, 1); return $features_with_values; }
public function actionPassword_change() { $model = new ChangePasswordModel(); if (Yii::$app->request->isPost) { if ($model->load(Yii::$app->request->post()) && $model->validate()) { $user = UserDb::find()->where(['id' => Yii::$app->user->getId()])->one(); $user->setPassword($model->newPassword); if ($user->save()) { Yii::$app->getSession()->setFlash('success', 'New password was saved.'); return $this->render('success_change_password'); } else { \yii\helpers\VarDumper::dump($user->getErrors()); exit; } } } return $this->render('form_change_password', ['model' => $model]); }
public function actionSomething() { $product = new Product(['sku' => 5463, 'upc' => '234569', 'price' => 4.99, 'title' => 'Clue by four', 'description' => 'Used for larting lusers or constructing things', 'dimensions' => ['unit' => 'inch', 'width' => 4, 'height' => 2, 'length' => 20], 'material' => 'wood']); $product->save(); /** @var Product $model */ $model = new Product(['title' => 'Car', 'specs.fuel.tank.capacity' => 50, 'specs.fuel.tank.capacity.unit' => 'liter']); $model->setAttribute('specs.wheels.count', 4); $model = Product::find()->where(['(!dimensions.length!)' => 10]); $section = Product::find()->select('CONCAT((! dimensions.width !), " x ", (! dimensions.height !))')->where(['id' => 11])->one(); $product = new Product(); $product->specs = new TvSpecs(['scenario' => 'insert']); $product->specs->load(Yii::$app->request->post()); if (!$model->validate()) { // process validation errors } $product->save(false); $thatTv = Product::findOne($product->id); \yii\helpers\VarDumper::dump($thatTv->specs); // $thatTv->specs equals $product->specs->toArray() }
/** * Creates a new Model model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { foreach (Yii::$app->params['availableLocales'] as $key => $value) { $currentModel = Price::getLocaleInstance($key); $currentModel->locale = $key; if (Yii::$app->request->get('scenario')) { $currentModel->on_scenario = Yii::$app->request->get('scenario'); } $models[$key] = $currentModel; } //set data from default model if (Yii::$app->request->get('locale_group_id')) { $defaultDomainModels = Price::find()->andFilterWhere(['domain_id' => Yii::getAlias('@defaultDomainId'), 'locale_group_id' => Yii::$app->request->get('locale_group_id')])->all(); foreach ($defaultDomainModels as $key => $value) { if (!in_array($value->locale, array_keys(Yii::$app->params['availableLocales']))) { continue; } $models[$value->locale]->model = $value->model; $models[$value->locale]->version_code = $value->version_code; $models[$value->locale]->body_type = $value->body_type; $models[$value->locale]->body = $value->body; $models[$value->locale]->price = $value->price; } } $model = new MultiModel(['models' => $models]); \yii\helpers\VarDumper::dump(Yii::$app->request->post(), 11, 1); if ($model->load(Yii::$app->request->post()) && Price::multiSave($model)) { return $this->redirect(['index']); } else { switch (Yii::$app->request->get('scenario')) { case 'extend': $viewName = 'extend'; break; default: $viewName = 'create'; } return $this->render($viewName, ['model' => $model, 'domains' => array_combine(explode(',', Yii::getAlias('@frontendUrls')), explode(',', Yii::getAlias('@frontendUrls')))]); } }
/** * Creates a new Keluarga model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Keluarga(); if ($model->load(Yii::$app->request->post())) { $no_kk = substr($model->kepala_keluarga, 0, 6) . Yii::$app->formatter->asDate('now', 'ddMMyy') . $model->id; $model->id = $no_kk; $model->tanggal_terbit = date('Y-m-d'); $model->tanggal_pembaruan = date('Y-m-d'); $model->status = 1; $updatable = BaseUpdatable::findOne($model->kepala_keluarga); $updatable->no_kk = $no_kk; $updatable->status_keluarga = 1; //echo var_dump($model); if ($model->save() && $updatable->save()) { $this->writeLog("Membuat kartu keluarga dengan nomor KK {$keluarga->id}"); return $this->redirect(['view', 'id' => $model->id]); } else { VarDumper::dump($model->getErrors(), 5678, true); //return $this->actionIndex(); } } else { return $this->renderAjax('create', ['model' => $model]); } }
<?php echo Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['title', 'description:ntext']]); ?> <h3>Ancestors</h3> <?php \yii\helpers\VarDumper::dump($model->ancestors()->all(), 3, TRUE); ?> <h3>Descendants</h3> <?php \yii\helpers\VarDumper::dump($model->descendants()->all(), 3, TRUE); ?> <h3>Previous</h3> <?php \yii\helpers\VarDumper::dump($model->prev()->all(), 3, TRUE); ?> <h3>Next</h3> <?php \yii\helpers\VarDumper::dump($model->next()->all(), 3, TRUE); ?> </div>
?> <div class="category-view"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['title', 'description:ntext']]); ?> <h3>Parent</h3> <?php \yii\helpers\VarDumper::dump($parent, 3, TRUE); ?> <h3>Prev</h3> <?php \yii\helpers\VarDumper::dump($prev, 3, TRUE); ?> </div>
public function actionResumoDia() { $data = '2015-08-17'; $entradas = CaixaMovimentacao::find()->where(['caixa_movimentacao_tipo_id' => 5, ['between', 'data', $data . ' 00:00:00', $data . ' 23:59:59']])->all(); $query = CaixaMovimentacao::find()->where("idcliente in(SELECT cliente_idcliente FROM `sgo-v1-final`.venda where idvenda in(SELECT venda_idvenda FROM `sgo-v1-final`.parcela where (data_pagamento is null and data_vencimento < DATE(NOW()))))"); VarDumper::dump($entradas, 10, true); die; }
<?php use cornernote\dashboard\panels\TextPanel; use yii\helpers\VarDumper; use yii\web\View; /** * @var $panel TextPanel * @var $this View */ ?> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"> <?php echo $panel->dashboardPanel->name; ?> <div class="pull-right"> <?php echo $this->render('@cornernote/dashboard/views/dashboard/panels/_buttons', ['panel' => $panel]); ?> </div> </h3> </div> <div class="panel-body"> <?php VarDumper::dump($panel->dashboardPanel->options); ?> </div> </div>
public static function dump(BaseActiveRecord $model) { if ($model->hasErrors()) { VarDumper::dump(['class' => get_class($model), 'attributes' => $model->getAttributes(), 'errors' => $model->getErrors()]); } else { VarDumper::dump(['class' => get_class($model), 'attributes' => $model->getAttributes()]); } }
public static function dump($var, $depth = 10) { VarDumper::dump($var, $depth, true); }
/** * Создание подкатегории (forum_name) * * @param string $subcat_name * @return bool|Subcategory */ private function importSubcategory($subcat_name) { $model = Subcategory::findOne(['forum_name' => $subcat_name]); if ($model === null) { $model = new Subcategory(['forum_name' => $subcat_name]); } if ($model->save()) { return $model; } else { VarDumper::dump($model->errors); } return false; }