Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require yii only once #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Require yii only once #5

wants to merge 1 commit into from

Conversation

naffiq
Copy link

@naffiq naffiq commented Mar 6, 2017

Hi!
Thanks for the great solution, but we encountered a problem, when we try to create couple of Environment classes.
The error we were getting is Fatal error: Cannot declare class Yii, because the name is already in use, and after some debugging we've figured out, that Environment class uses require($this->yiiPath) instead of require_once($this->yiiPath).
If this change wouldn't break anything, I would highly appreciate merging it to master and releasing new version with this "fix" so we can get rid of overriden version of this class in our project

@naffiq
Copy link
Author

naffiq commented Mar 15, 2017

Is there any chance of this request being merged or should I close it?

@cebe
Copy link

cebe commented Mar 22, 2017

This looks suspicious, why are you calling setup() twice?

@naffiq
Copy link
Author

naffiq commented Mar 22, 2017

@cebe
I was running tests with Codeception and have following config in codecept.yml file:

modules:
    config:
        Yii2:
            configFile: 'config/codeception.php'
            cleanup: false

And my config/codeception.php file is:

<?php
require_once(__DIR__ . '/../vendor/autoload.php');
require_once(__DIR__ . '/../components/rocket/RFEnvironment.php');
$env = new \app\components\RFEnvironment( // My overriden Environment class
    [
        dirname(__DIR__) . '/config'
    ],
    'test'
);
$env->setup();
return $env->web;

Maybe I structured the whole thing wrong, but requiring Yii once solved the problem.
If this change impacts others' code I'm ok with overriding Environment class for my case until I find better structure for my project.

Would be really grateful for helping me with configuring testing environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants