Skip to content
This repository has been archived by the owner on Jun 9, 2020. It is now read-only.

fix YII_ENV constant check and use dirname #39

Closed
wants to merge 1 commit into from

Conversation

allyraza
Copy link

Q A
Is bugfix? yes
New feature? no
Breaks BC? no
Tests pass? yes
Fixed issues comma-separated list of tickets # fixed by the PR, if any

require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../config/env.php';
require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php';
require dirname(__DIR__) . '/vendor/autoload.php';
Copy link
Contributor

Choose a reason for hiding this comment

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

I find __DIR__ . '/../' more readable than the usage of dirname().

Copy link
Author

Choose a reason for hiding this comment

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

I could also say the same about dirname(__DIR__) being more readable to me, why I sent a PR is more about being consistent dirname(__DIR__) is being used everywhere other than index.php take a look at config/web.php and config/console.php

Copy link
Contributor

@schmunk42 schmunk42 Jun 26, 2018

Choose a reason for hiding this comment

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

I'd prefer to change those config/web.php and config/console.php

I.e. if there would be something like __DIR__ . '/../../' you'd need to write dirname(dirname(__DIR__)).

Or we introduce a variable like $rootPath.

Copy link

Choose a reason for hiding this comment

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

Since PHP 7.0 dirname() has a second parameter for levels, so you can use dirname(__DIR__, 2).

I'm for creating APP_ROOT constant and use it as a root to build paths. DRY.

@@ -4,6 +4,7 @@

use Yii;
use yii\base\Model;
use app\models\User;
Copy link
Contributor

Choose a reason for hiding this comment

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

While this is currently required for the template to work I'd prefer to remove the User model and login completely and rather have something in the docs which describes how to install a full-featured module such as yii2-usuario.

Copy link
Author

@allyraza allyraza Jun 26, 2018

Choose a reason for hiding this comment

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

I don't think it is very wise to have a demo app which does not work or throws an error, it should work out of the box and docs should indicate how to use a different user module.

Copy link
Contributor

@schmunk42 schmunk42 Jun 26, 2018

Choose a reason for hiding this comment

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

Details added in yiisoft/app#40

Copy link
Member

Choose a reason for hiding this comment

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

Not a question of the current PR for sure.

@@ -57,11 +57,11 @@
*/
];

if (YII_ENV_DEV) {
if (YII_ENV == 'dev') {
Copy link
Member

Choose a reason for hiding this comment

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

===

config/web.php Outdated
@@ -73,18 +73,18 @@
'params' => $params,
];

if (YII_ENV_DEV) {
if (YII_ENV == 'dev') {
Copy link
Member

Choose a reason for hiding this comment

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

===

@@ -4,6 +4,7 @@

use Yii;
use yii\base\Model;
use app\models\User;
Copy link
Member

Choose a reason for hiding this comment

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

Not a question of the current PR for sure.

@kids-return
Copy link
Contributor

Missing /bin/yii

@hiqsol hiqsol force-pushed the master branch 2 times, most recently from 458de03 to e0c99f4 Compare August 9, 2018 09:19
@hiqsol
Copy link
Member

hiqsol commented Aug 25, 2018

Sorry, closing this PR.
This package is rewritten substantially.
Please redo your PR if it is still actual.

@hiqsol hiqsol closed this Aug 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants