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

The console controller can only run within a console Application context. #2073

Closed
mhunesi opened this issue Jan 3, 2021 · 8 comments
Closed

Comments

@mhunesi
Copy link

mhunesi commented Jan 3, 2021

What steps will reproduce the problem?

I have two controllers;

  1. commands/SettingsController --->
  2. controllers/SettingsController ---> This Custom Controller.

What is the expected result?

The console controller can only run within a console Application context.

What do you get instead? (A Screenshot can help us a lot!)

image

image

LUYA Check ouput (run this script and post the result: luyacheck.php)

This not working on nginx.

Additional infos

Q A
LUYA Version 1.0.24
PHP Version 7.4
Platform Nginx
Operating system OSX
@nadar
Copy link
Member

nadar commented Jan 3, 2021

I dont understand what command you try to execute? Anyhow desired in LUYA is to use the commands folder. What should the other Controller do? What class do you extend from?

@mhunesi
Copy link
Author

mhunesi commented Jan 4, 2021

When I execute controllers/SettingsController
Link: http://localhost/en/admin#!/default/5/mymoduleadmin/settings/index

mymoduleadmin has controllers/SettingsController and commands/SettingsController

controllers/SettingsController

namespace app\modules\mymodule\admin\controllers;

class SettingsController extends luya\admin\base\Controller {
    public function actionIndex()
        {
            return $this->render('index', [
                'data' => [], // Data to assign into the view file `index`.
            ]);
        }
}

commands/SettingsController

namespace app\modules\mymodule\admin\commands;

class SettingsController extends \luya\console\Command {
  public function actionIndex()
    {
        return $this->outputSuccess('Action successfully done');
    }
}

Thanks.

@nadar
Copy link
Member

nadar commented Jan 4, 2021

So to understand that correctly: You are trying to access the class SettingsController extends luya\admin\base\Controller with mymoduleadmin/settings/index but it seems to run the SettingsController extends \luya\console\Command which of course throws the exception from above? Is that the problem?

@bee1194
Copy link

bee1194 commented Jan 11, 2021

So i can not use tablePrefix in database. Can you check it?. in file \luyadev\luya-module-admin\src\models\UserGroup.php, line 29 should use {{%admin_user_group}} instead of admin_user_group
Thank you

@nadar
Copy link
Member

nadar commented Jan 11, 2021

Hi @bee1194 i don't think this has something to do with the topic, but yes you are right. We should fix that. could you send me a PR or create an issue? Thanks

@mhunesi
Copy link
Author

mhunesi commented Jan 25, 2021

So to understand that correctly: You are trying to access the class SettingsController extends luya\admin\base\Controller with mymoduleadmin/settings/index but it seems to run the SettingsController extends \luya\console\Command which of course throws the exception from above? Is that the problem?

Yes. luya-core/console/Controller.php class throws the exception.

@nadar
Copy link
Member

nadar commented Feb 11, 2021

@mhunesi so the web request http://localhost/en/admin#!/default/5/mymoduleadmin/settings/index runs the console command? is that your problem? sorry for the delay

@nadar
Copy link
Member

nadar commented Nov 9, 2022

I am going to close this issue because:

  • Its a question (Please post questions at LUYA discussions)
  • Missing information's
  • No more activity
  • No one picked up the task (no Pull Request received)

If you think this is still important or there are more/new informations. Please reopen the issue and let us know.

If this is a problem or a feature you like to discuss, join our discussion: LUYA discussions. We try to keep our issue tracker as clean as possible in order to focus on active issues.

@nadar nadar closed this as completed Nov 9, 2022
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

3 participants