Commit 0d669f5e by Carsten Brandt

refactored params methods in Request

issue #2043
parent 65179b10
...@@ -53,7 +53,7 @@ class DbPanel extends Panel ...@@ -53,7 +53,7 @@ class DbPanel extends Panel
public function getDetail() public function getDetail()
{ {
$searchModel = new Db(); $searchModel = new Db();
$dataProvider = $searchModel->search(Yii::$app->request->get(), $this->getModels()); $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams(), $this->getModels());
return Yii::$app->view->render('panels/db/detail', [ return Yii::$app->view->render('panels/db/detail', [
'panel' => $this, 'panel' => $this,
......
...@@ -39,7 +39,7 @@ class LogPanel extends Panel ...@@ -39,7 +39,7 @@ class LogPanel extends Panel
public function getDetail() public function getDetail()
{ {
$searchModel = new Log(); $searchModel = new Log();
$dataProvider = $searchModel->search(Yii::$app->request->get(), $this->getModels()); $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams(), $this->getModels());
return Yii::$app->view->render('panels/log/detail', [ return Yii::$app->view->render('panels/log/detail', [
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
......
...@@ -42,7 +42,7 @@ class ProfilingPanel extends Panel ...@@ -42,7 +42,7 @@ class ProfilingPanel extends Panel
public function getDetail() public function getDetail()
{ {
$searchModel = new Profile(); $searchModel = new Profile();
$dataProvider = $searchModel->search(Yii::$app->request->get(), $this->getModels()); $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams(), $this->getModels());
return Yii::$app->view->render('panels/profile/detail', [ return Yii::$app->view->render('panels/profile/detail', [
'panel' => $this, 'panel' => $this,
......
...@@ -96,6 +96,9 @@ Yii Framework 2 Change Log ...@@ -96,6 +96,9 @@ Yii Framework 2 Change Log
- Chg #1821: Changed default values for yii\db\Connection username and password to null (cebe) - Chg #1821: Changed default values for yii\db\Connection username and password to null (cebe)
- Chg #1844: `Response::sendFile()` and other file sending methods will not send the response (qiangxue) - Chg #1844: `Response::sendFile()` and other file sending methods will not send the response (qiangxue)
- Chg #1852: DbConnection::tablePrefix default value now 'tbl_' (creocoder) - Chg #1852: DbConnection::tablePrefix default value now 'tbl_' (creocoder)
- Chg #2043: Renamed `yii\web\Request::acceptedLanguages` to `acceptableLanguages` (qiangxue)
- Chg #2043: Removed `yii\web\Request::getPut()`, `getDelete()`, `getPatch()` in favor of `getBodyParam()` (cebe)
- Chg #2043: Renamed `yii\web\Request::get()` to `getQueryParams()` and `getRestParams()` to `getBodyParams()` (cebe)
- Chg #2057: AutoTimestamp attributes defaults changed from `create_time` and `update_time` to `created_at` and `updated_at` (creocoder) - Chg #2057: AutoTimestamp attributes defaults changed from `create_time` and `update_time` to `created_at` and `updated_at` (creocoder)
- Chg #2063: Removed `yii\web\Request::acceptTypes` and renamed `yii\web\Request::acceptedContentTypes` to `acceptableContentTypes` (qiangxue) - Chg #2063: Removed `yii\web\Request::acceptTypes` and renamed `yii\web\Request::acceptedContentTypes` to `acceptableContentTypes` (qiangxue)
- Chg: Renamed `yii\jui\Widget::clientEventsMap` to `clientEventMap` (qiangxue) - Chg: Renamed `yii\jui\Widget::clientEventsMap` to `clientEventMap` (qiangxue)
...@@ -108,7 +111,6 @@ Yii Framework 2 Change Log ...@@ -108,7 +111,6 @@ Yii Framework 2 Change Log
- Chg: Changed the directory structure according to PSR-4. You have to update your application `index.php`, - Chg: Changed the directory structure according to PSR-4. You have to update your application `index.php`,
`index-test.php` and `yii` files to point to the new location of `Yii.php` (qiangxue, cebe) `index-test.php` and `yii` files to point to the new location of `Yii.php` (qiangxue, cebe)
- Chg: Advanced app template: moved database connection DSN, login and password to `-local` config not to expose it to VCS (samdark) - Chg: Advanced app template: moved database connection DSN, login and password to `-local` config not to expose it to VCS (samdark)
- Chg: Renamed `yii\web\Request::acceptedLanguages` to `acceptableLanguages` (qiangxue)
- New #66: [Auth client library](https://github.com/yiisoft/yii2-authclient) OpenId, OAuth1, OAuth2 clients (klimov-paul) - New #66: [Auth client library](https://github.com/yiisoft/yii2-authclient) OpenId, OAuth1, OAuth2 clients (klimov-paul)
- New #1393: [Codeception testing framework integration](https://github.com/yiisoft/yii2-codeception) (Ragazzo) - New #1393: [Codeception testing framework integration](https://github.com/yiisoft/yii2-codeception) (Ragazzo)
- New #1438: [MongoDB integration](https://github.com/yiisoft/yii2-mongodb) ActiveRecord and Query (klimov-paul) - New #1438: [MongoDB integration](https://github.com/yiisoft/yii2-mongodb) ActiveRecord and Query (klimov-paul)
......
...@@ -141,7 +141,7 @@ class Pagination extends Object ...@@ -141,7 +141,7 @@ class Pagination extends Object
if ($this->_page === null || $recalculate) { if ($this->_page === null || $recalculate) {
if (($params = $this->params) === null) { if (($params = $this->params) === null) {
$request = Yii::$app->getRequest(); $request = Yii::$app->getRequest();
$params = $request instanceof Request ? $request->get() : []; $params = $request instanceof Request ? $request->getQueryParams() : [];
} }
if (isset($params[$this->pageVar]) && is_scalar($params[$this->pageVar])) { if (isset($params[$this->pageVar]) && is_scalar($params[$this->pageVar])) {
$this->_page = (int)$params[$this->pageVar] - 1; $this->_page = (int)$params[$this->pageVar] - 1;
...@@ -183,7 +183,7 @@ class Pagination extends Object ...@@ -183,7 +183,7 @@ class Pagination extends Object
{ {
if (($params = $this->params) === null) { if (($params = $this->params) === null) {
$request = Yii::$app->getRequest(); $request = Yii::$app->getRequest();
$params = $request instanceof Request ? $request->get() : []; $params = $request instanceof Request ? $request->getQueryParams() : [];
} }
if ($page > 0 || $page >= 0 && $this->forcePageVar) { if ($page > 0 || $page >= 0 && $this->forcePageVar) {
$params[$this->pageVar] = $page + 1; $params[$this->pageVar] = $page + 1;
......
...@@ -245,7 +245,7 @@ class Sort extends Object ...@@ -245,7 +245,7 @@ class Sort extends Object
$this->_attributeOrders = []; $this->_attributeOrders = [];
if (($params = $this->params) === null) { if (($params = $this->params) === null) {
$request = Yii::$app->getRequest(); $request = Yii::$app->getRequest();
$params = $request instanceof Request ? $request->get() : []; $params = $request instanceof Request ? $request->getQueryParams() : [];
} }
if (isset($params[$this->sortVar]) && is_scalar($params[$this->sortVar])) { if (isset($params[$this->sortVar]) && is_scalar($params[$this->sortVar])) {
$attributes = explode($this->separators[0], $params[$this->sortVar]); $attributes = explode($this->separators[0], $params[$this->sortVar]);
...@@ -341,7 +341,7 @@ class Sort extends Object ...@@ -341,7 +341,7 @@ class Sort extends Object
{ {
if (($params = $this->params) === null) { if (($params = $this->params) === null) {
$request = Yii::$app->getRequest(); $request = Yii::$app->getRequest();
$params = $request instanceof Request ? $request->get() : []; $params = $request instanceof Request ? $request->getQueryParams() : [];
} }
$params[$this->sortVar] = $this->createSortVar($attribute); $params[$this->sortVar] = $this->createSortVar($attribute);
$route = $this->route === null ? Yii::$app->controller->getRoute() : $this->route; $route = $this->route === null ? Yii::$app->controller->getRoute() : $this->route;
......
...@@ -237,7 +237,7 @@ class BaseHtml ...@@ -237,7 +237,7 @@ class BaseHtml
if ($request instanceof Request) { if ($request instanceof Request) {
if (strcasecmp($method, 'get') && strcasecmp($method, 'post')) { if (strcasecmp($method, 'get') && strcasecmp($method, 'post')) {
// simulate PUT, DELETE, etc. via POST // simulate PUT, DELETE, etc. via POST
$hiddenInputs[] = static::hiddenInput($request->restVar, $method); $hiddenInputs[] = static::hiddenInput($request->methodVar, $method);
$method = 'post'; $method = 'post';
} }
if ($request->enableCsrfValidation && !strcasecmp($method, 'post')) { if ($request->enableCsrfValidation && !strcasecmp($method, 'post')) {
......
...@@ -217,7 +217,7 @@ class UrlManager extends Component ...@@ -217,7 +217,7 @@ class UrlManager extends Component
return [$pathInfo, []]; return [$pathInfo, []];
} else { } else {
Yii::trace('Pretty URL not enabled. Using default URL parsing logic.', __METHOD__); Yii::trace('Pretty URL not enabled. Using default URL parsing logic.', __METHOD__);
$route = $request->get($this->routeVar); $route = $request->getQueryParam($this->routeVar, '');
if (is_array($route)) { if (is_array($route)) {
$route = ''; $route = '';
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment