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

Using alias in extra config-plugin #19

Closed
fcaldarelli opened this issue Jan 11, 2019 · 2 comments
Closed

Using alias in extra config-plugin #19

fcaldarelli opened this issue Jan 11, 2019 · 2 comments

Comments

@fcaldarelli
Copy link

fcaldarelli commented Jan 11, 2019

I'm using an alias inside extra config-plugin.

This is from yii-console package:

    "extra": {
        "branch-alias": {
            "dev-master": "3.0.x-dev"
        },
        "config-plugin": {
            "params": "config/params.php",
            "console": "config/console.php",
            "tests": "$console"
        }
    },

or "tests": ["$console"] , the result is the same.

The output is this:

  'console' => 
  array (
    0 => '$common',
    1 => $baseDir . '/config/console.php',
  ),
  'web' => 
  array (
    0 => '$common',
    1 => $baseDir . '/vendor/yiisoft/yii-web/config/web.php',
  ),
  'tests' => 
  array (
    0 => '$console',
    1 => $baseDir . '/vendor/yiisoft/yii-core/config/tests.php',
    2 => '$web',
    3 => $baseDir . '/vendor/yiisoft/view/config/tests.php',
    4 => $baseDir . '/vendor/yiisoft/db-mysql/config/tests.php',
    5 => '$common',
    6 => $baseDir . '/vendor/yiisoft/db-sqlite/config/tests.php',
  ),

so console block will be overridden by all other configurations.

Finally, if I open tests.php, I have:

  'response' => 
  array (
    '__class' => 'yii\\web\\Response',
    'formatters' => 
    array (
      'html' => 
      array (
        '__class' => 'yii\\web\\formatters\\HtmlResponseFormatter',
      ),
      'xml' => 
      array (
        '__class' => 'yii\\web\\formatters\\XmlResponseFormatter',
      ),
      'json' => 
      array (
        '__class' => 'yii\\web\\formatters\\JsonResponseFormatter',
      ),
      'jsonp' => 
      array (
        '__class' => 'yii\\web\\formatters\\JsonResponseFormatter',
        'useJsonp' => true,
      ),
    ),
  ),

when 'response' should have yii\console\Response class.

The fastest solution that I found is to use direct definition in config-plugin:

"tests": "config/console.php",

@hiqsol
Copy link
Member

hiqsol commented Jan 11, 2019

This is serious problem that is there from very beginning.
I have ideas how to fix it. Looks like time has come to fix it finally :)

@fcaldarelli
Copy link
Author

Why do you think that it is a serious problem?

Ok, but we can always set manually:

"tests": "config/console.php",

@hiqsol hiqsol closed this as completed in 83bc091 Jan 11, 2019
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

No branches or pull requests

2 participants