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

Use from Api Rest #37

Open
leocharrua opened this issue Nov 4, 2022 · 0 comments
Open

Use from Api Rest #37

leocharrua opened this issue Nov 4, 2022 · 0 comments

Comments

@leocharrua
Copy link

Hello. I have a API that intents to use the setting class, but fails because I don't have cache enabled for Api.

2022-11-04 05:36:03 [::1][1][kteog0p8ofjkjphvu42178ltpv][trace][yii\web\Application::handleRequest] Route requested: 'report/export'
2022-11-04 05:36:03 [::1][1][kteog0p8ofjkjphvu42178ltpv][trace][yii\base\Controller::runAction] Route to run: report/export
2022-11-04 05:36:03 [::1][1][kteog0p8ofjkjphvu42178ltpv][trace][yii\base\InlineAction::runWithParams] Running action: app\controllers\api\ReportController::actionExport()
2022-11-04 05:36:03 [::1][1][kteog0p8ofjkjphvu42178ltpv][trace][yii\base\View::renderFile] Rendering view file: R:\wamp\www\workana_alc_armando\alc_admin_lte\views\report_pdfDailyReport.php
in R:\wamp\www\workana_alc_armando\alc_admin_lte\controllers\api\ReportController.php:209
2022-11-04 05:36:04 [::1][1][kteog0p8ofjkjphvu42178ltpv][error][yii\di\NotInstantiableException] ReflectionException: Class cache does not exist in R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\di\Container.php:507
Stack trace:
#0 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\di\Container.php(507): ReflectionClass->__construct('cache')
#1 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\di\Container.php(385): yii\di\Container->getDependencies('cache')
#2 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\di\Container.php(170): yii\di\Container->build('cache', Array, Array)
#3 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\di\Instance.php(175): yii\di\Container->get('cache')
#4 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\di\Instance.php(144): yii\di\Instance->get(NULL)
#5 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yii2mod\yii2-settings\components\Settings.php(63): yii\di\Instance::ensure(Object(yii\di\Instance), 'yii\caching\Cac...')
#6 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\base\BaseObject.php(109): yii2mod\settings\components\Settings->init()
#7 [internal function]: yii\base\BaseObject->__construct(Array)
#8 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\di\Container.php(411): ReflectionClass->newInstanceArgs(Array)
#9 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\di\Container.php(170): yii\di\Container->build('yii2mod\setting...', Array, Array)
#10 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\BaseYii.php(365): yii\di\Container->get('yii2mod\setting...', Array, Array)
#11 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\di\ServiceLocator.php(137): yii\BaseYii::createObject(Array)
#12 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\base\Module.php(766): yii\di\ServiceLocator->get('settings', true)
#13 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\di\ServiceLocator.php(74): yii\base\Module->get('settings')
#14 R:\wamp\www\workana_alc_armando\alc_admin_lte\components\Helper.php(457): yii\di\ServiceLocator->__get('settings')
#15 R:\wamp\www\workana_alc_armando\alc_admin_lte\views\report_pdfDailyReport.php(17): app\components\Helper::setLanguageTemp()
#16 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\base\View.php(347): require('R:\wamp\www\wor...')
#17 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\base\View.php(257): yii\base\View->renderPhpFile('R:\wamp\www\wor...', Array)
#18 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\base\View.php(156): yii\base\View->renderFile('R:\wamp\www\wor...', Array, Object(app\controllers\api\ReportController))
#19 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\base\Controller.php(438): yii\base\View->render('_pdfDailyReport', Array, Object(app\controllers\api\ReportController))
#20 R:\wamp\www\workana_alc_armando\alc_admin_lte\controllers\api\ReportController.php(209): yii\base\Controller->renderPartial('_pdfDailyReport', Array)
#21 [internal function]: app\controllers\api\ReportController->actionExport('34')
#22 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)
#23 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\base\Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#24 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\base\Module.php(552): yii\base\Controller->runAction('export', Array)
#25 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\web\Application.php(103): yii\base\Module->runAction('report/export', Array)
#26 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\base\Application.php(384): yii\web\Application->handleRequest(Object(yii\web\Request))
#27 R:\wamp\www\workana_alc_armando\alc_admin_lte\api\index.php(12): yii\base\Application->run()
#28 {main}

Next yii\di\NotInstantiableException: Failed to instantiate component or class "cache". in R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\di\Container.php:509
Stack trace:
#0 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\di\Container.php(385): yii\di\Container->getDependencies('cache')
#1 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\di\Container.php(170): yii\di\Container->build('cache', Array, Array)
#2 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\di\Instance.php(175): yii\di\Container->get('cache')
#3 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\di\Instance.php(144): yii\di\Instance->get(NULL)
#4 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yii2mod\yii2-settings\components\Settings.php(63): yii\di\Instance::ensure(Object(yii\di\Instance), 'yii\caching\Cac...')
#5 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\base\BaseObject.php(109): yii2mod\settings\components\Settings->init()
#6 [internal function]: yii\base\BaseObject->__construct(Array)
#7 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\di\Container.php(411): ReflectionClass->newInstanceArgs(Array)
#8 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\di\Container.php(170): yii\di\Container->build('yii2mod\setting...', Array, Array)
#9 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\BaseYii.php(365): yii\di\Container->get('yii2mod\setting...', Array, Array)
#10 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\di\ServiceLocator.php(137): yii\BaseYii::createObject(Array)
#11 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\base\Module.php(766): yii\di\ServiceLocator->get('settings', true)
#12 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\di\ServiceLocator.php(74): yii\base\Module->get('settings')
#13 R:\wamp\www\workana_alc_armando\alc_admin_lte\components\Helper.php(457): yii\di\ServiceLocator->__get('settings')
#14 R:\wamp\www\workana_alc_armando\alc_admin_lte\views\report_pdfDailyReport.php(17): app\components\Helper::setLanguageTemp()
#15 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\base\View.php(347): require('R:\wamp\www\wor...')
#16 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\base\View.php(257): yii\base\View->renderPhpFile('R:\wamp\www\wor...', Array)
#17 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\base\View.php(156): yii\base\View->renderFile('R:\wamp\www\wor...', Array, Object(app\controllers\api\ReportController))
#18 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\base\Controller.php(438): yii\base\View->render('_pdfDailyReport', Array, Object(app\controllers\api\ReportController))
#19 R:\wamp\www\workana_alc_armando\alc_admin_lte\controllers\api\ReportController.php(209): yii\base\Controller->renderPartial('_pdfDailyReport', Array)
#20 [internal function]: app\controllers\api\ReportController->actionExport('34')
#21 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)
#22 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\base\Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#23 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\base\Module.php(552): yii\base\Controller->runAction('export', Array)
#24 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\web\Application.php(103): yii\base\Module->runAction('report/export', Array)
#25 R:\wamp\www\workana_alc_armando\alc_admin_lte\vendor\yiisoft\yii2\base\Application.php(384): yii\web\Application->handleRequest(Object(yii\web\Request))
#26 R:\wamp\www\workana_alc_armando\alc_admin_lte\api\index.php(12): yii\base\Application->run()
#27 {main}
2022-11-04 05:36:03 [::1][1][kteog0p8ofjkjphvu42178ltpv][info][application] $_GET = [
'id' => '34'

How I can resolve this scenario?
Thanks

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