Answer the question
In order to leave comments, you need to log in
Why can't Yii2 inject dependency and throw NotInstantiableException?
Exception 'yii\di\NotInstantiableException' with message 'Can't instantiate core\lib\goodsProvider\GoodsBuffer.'
There is a GoodsBuffer class - it itself without a constructor:
It must be thrown as a dependency into the JackFinder class, GoodsBuffer goes as the 2nd parameter:
I get an exception: Exception 'yii\di\NotInstantiableException' with message 'Can not instantiate core\lib\goodsProvider\GoodsBuffer .'
Exception 'yii\di\NotInstantiableException' with message 'Can not instantiate core\lib\goodsProvider\GoodsBuffer.'
in E:\Program\OpenServer\domains\work\martashop.loc\vendor\yiisoft\yii2\di\Container.php:543
Stack trace:
#0 E:\Program\OpenServer\domains\work\martashop.loc\vendor\yiisoft\yii2\di\Container.php(386): yii\di\Container->getDependencies('core\\lib\\jack...')
#1 E:\Program\OpenServer\domains\work\martashop.loc\vendor\yiisoft\yii2\di\Container.php(171): yii\di\Container->build('core\\lib\\jack...', Array, Array)
#2 E:\Program\OpenServer\domains\work\martashop.loc\core\lib\goodsProvider\ProviderFactory.php(81): yii\di\Container->get('core\\lib\\jack...')
#3 E:\Program\OpenServer\domains\work\martashop.loc\core\lib\goodsProvider\ProviderFactory.php(65): core\lib\goodsProvider\ProviderFactory->creator('jack', Array, 'core\\lib\\goodsP...')
#4 E:\Program\OpenServer\domains\work\martashop.loc\core\services\goods\import\GoodsUpdater.php(28): core\lib\goodsProvider\ProviderFactory->createFinderClass('jack')
#5 E:\Program\OpenServer\domains\work\martashop.loc\console\controllers\GoodsController.php(77): core\services\goods\import\GoodsUpdater->update(Object(core\entities\Goods\Goods))
#6 [internal function]: console\controllers\GoodsController->actionUpdate()
#7 E:\Program\OpenServer\domains\work\martashop.loc\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)
#8 E:\Program\OpenServer\domains\work\martashop.loc\vendor\yiisoft\yii2\base\Controller.php(181): yii\base\InlineAction->runWithParams(Array)
#9 E:\Program\OpenServer\domains\work\martashop.loc\vendor\yiisoft\yii2\console\Controller.php(184): yii\base\Controller->runAction('update', Array)
#10 E:\Program\OpenServer\domains\work\martashop.loc\vendor\yiisoft\yii2\base\Module.php(534): yii\console\Controller->runAction('update', Array)
#11 E:\Program\OpenServer\domains\work\martashop.loc\vendor\yiisoft\yii2\console\Application.php(181): yii\base\Module->runAction('goods/update', Array)
#12 E:\Program\OpenServer\domains\work\martashop.loc\vendor\yiisoft\yii2\console\Application.php(148): yii\console\Application->runAction('goods/update', Array)
#13 E:\Program\OpenServer\domains\work\martashop.loc\vendor\yiisoft\yii2\base\Application.php(392): yii\console\Application->handleRequest(Object(yii\console\Request))
#14 E:\Program\OpenServer\domains\work\martashop.loc\yii(23): yii\base\Application->run()
#15 {main}
Answer the question
In order to leave comments, you need to log in
Hang up. I guessed to call the class without DI, through new:
public function __construct()
{
$this->buffer = new GoodsBuffer();
}
Exception 'ParseError' with message 'syntax error, unexpected 'array' (T_ARRAY), expecting function (T_FUNCTION) or const (T_CONST)'
Try like this
SELECT id,SUM(кол-во)
GROUP BY id
HAVING SUM(кол-во) > someValue
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question