Skip to content

Commit

Permalink
Dev: Update dataentry.php
Browse files Browse the repository at this point in the history
- Replaced Yii:app() with App().
  • Loading branch information
thedirtypanda authored and olleharstedt committed Apr 2, 2020
1 parent e1dcc5f commit 59e1d5f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions application/controllers/admin/dataentry.php
Expand Up @@ -1434,8 +1434,8 @@ public function update()
*/
public function insert()
{
$subaction = Yii::app()->request->getPost('subaction');
$surveyid = (int) Yii::app()->request->getPost('sid');
$subaction = App()->request->getPost('subaction');
$surveyid = (int) Yii::app()->request->getPost('sid');

$lang = isset($_POST['lang']) ? Yii::app()->request->getPost('lang') : null;
$survey = Survey::model()->findByPk($surveyid);
Expand All @@ -1450,7 +1450,7 @@ public function insert()
$thissurvey = getSurveyInfo($surveyid);
$errormsg = "";

Yii::app()->loadHelper("database");
App()->loadHelper("database");
$aViewUrls = [];
$aViewUrls['display']['menu_bars']['browse'] = gT("Data entry");

Expand Down

7 comments on commit 59e1d5f

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question : what advantage to use App ? (because sometimes i use App, and some other time Y::app ...)

@olleharstedt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No difference afaik.

@olleharstedt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the end both should be removed and passed as an explicit dependency to a service class.

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No difference afaik.

Yes, sure, but did we really need App ?

In the end both should be removed and passed as an explicit dependency to a service class.

use Yii ...

@olleharstedt
Copy link
Contributor

@olleharstedt olleharstedt commented on 59e1d5f Apr 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public function __construct(CWebApplication $app) { ... }

@thedirtypanda
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im using App() cause, PHPStorm is crying about 'Multiple definitions of Yii'. Also the warning will be reduced. Cause if im not doing this, the whole file will be yellow with warnings. App() is reducing the warnigns also and PHPStorm can find Yii app then.

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, then next time i use App() ;)

Please sign in to comment.