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

incorrect current language set in Behavior if use from extension #79

Open
igorveremsky opened this issue Oct 30, 2018 · 0 comments
Open

Comments

@igorveremsky
Copy link
Contributor

igorveremsky commented Oct 30, 2018

I have an extension with MultilingualActiveRecord.php that extends from ActiveRecord.php has additional multilingual attributes sets and add your behavior to behaviors(). But when i extend model in my application from it i get incorrect values for multilingual attributes for current language, because MultilingualUrlManager.php set application language after loading MultilingualActiveRecord.php and $currentLanguage at MultilingualBehavior set from language parameter in application config instead of MultilingualUrlManager.php logic for get current language. So, i think method

public function getCurrentLanguage()
need be like

/**
     * @return mixed|string
     */
    public function getCurrentLanguage()
    {
        return Yii::$app->language;
    }

Also in general think $currentLanguage not needed in behavior because global yii application has language param.

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

1 participant