yii\base\InvalidConfigException: Object configuration must be an array containing a "class" element. in D:\wamp\www\wordpress\vendor\yiisoft\yii2\BaseYii.php:353
Stack trace:
#0 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\Application.php(49): yii\BaseYii::createObject(Array)
#1 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\Application.php(67): fecshop\services\Application->getChildService('image')
#2 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\product\Image.php(69): fecshop\services\Application->get('image')
#3 [internal function]: fecshop\services\product\Image->actionGetUrl('/default.jpg')
#4 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\Service.php(49): call_user_func_array(Array, Array)
#5 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\product\Image.php(103): fecshop\services\Service->__call('getUrl', Array)
#6 [internal function]: fecshop\services\product\Image->actionDefautImg()
#7 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\Service.php(49): call_user_func_array(Array, Array)
#8 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\category\Product.php(90): fecshop\services\Service->call('defautImg', Array)
#9 [internal function]: fecshop\services\category\Product->actionConvertToCategoryInfo(Array)
#10 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\Service.php(49): call_user_func_array(Array, Array)
#11 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\app\appfront\modules\Cms\block\home\Index.php(50): fecshop\services\Service->__call('convertToCatego...', Array)
#12 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\app\appfront\modules\Cms\block\home\Index.php(28): fecshop\app\appfront\modules\Cms\block\home\Index->getProductBySkus(Array)
#13 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\app\appfront\modules\Cms\block\home\Index.php(19): fecshop\app\appfront\modules\Cms\block\home\Index->getFeaturedProduct()
#14 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\app\appfront\modules\Cms\controllers\HomeController.php(19): fecshop\app\appfront\modules\Cms\block\home\Index->getLastData()
#15 [internal function]: fecshop\app\appfront\modules\Cms\controllers\HomeController->actionIndex()
#16 D:\wamp\www\wordpress\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)
#17 D:\wamp\www\wordpress\vendor\yiisoft\yii2\base\Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#18 D:\wamp\www\wordpress\vendor\yiisoft\yii2\base\Module.php(528): yii\base\Controller->runAction('index', Array)
#19 D:\wamp\www\wordpress\vendor\yiisoft\yii2\web\Application.php(103): yii\base\Module->runAction('cms/home/index', Array)
#20 D:\wamp\www\wordpress\vendor\yiisoft\yii2\base\Application.php(386): yii\web\Application->handleRequest(Object(fecshop\yii\web\Request))
#21 D:\wamp\www\wordpress\appfront\web\index.php(87): yii\base\Application->run()
#22 {main}
Copy Stacktrace Search Stackoverflow Search Google Exception
Invalid Configuration – yii\base\InvalidConfigException
Object configuration must be an array containing a "class" element.
in D:\wamp\www\wordpress\vendor\yiisoft\yii2\BaseYii.php at line 353
344345346347348349350351352353354355356357358359360361362 if (is_string($type)) {
return static::$container->get($type, $params);
} elseif (is_array($type) && isset($type['class'])) {
$class = $type['class'];
unset($type['class']);
return static::$container->get($class, $params, $type);
} elseif (is_callable($type, true)) {
return static::$container->invoke($type, $params);
} elseif (is_array($type)) {
throw new InvalidConfigException('Object configuration must be an array containing a "class" element.');
}
throw new InvalidConfigException('Unsupported configuration type: ' . gettype($type));
}
private static $_logger;
/**
- @return Logger message logger
- in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\Application.php at line 49 – yii\BaseYii::createObject(['appbase' => ['appfront' => ['basedir' => '@appimage/appfront', 'basedomain' => '//img.appfront.fancyecommerce.co...'], 'apphtml5' => ['basedir' => '@appimage/apphtml5', 'basedomain' => '//img.apphtml5.fancyecommerce.co...'], 'appadmin' => ['basedir' => '@appimage/appadmin', 'basedomain' => 'http://img2.fecshoptest.com'], 'common' => ['basedir' => '@appimage/common', 'basedomain' => '//img.fancyecommerce.com']]])
43444546474849505152535455
if (!$this->_childService[$childServiceName]) {
$childService = $this->childService;
if (isset($childService[$childServiceName])) {
$service = $childService[$childServiceName];
if(!isset($service['enableService']) || $service['enableService']){
$this->_childService[$childServiceName] = Yii::createObject($service);
}else{
throw new InvalidConfigException('Child Service ['.$childServiceName.'] is disable in '.get_called_class().', you must config it! ');
}
} else {
throw new InvalidConfigException('Child Service ['.$childServiceName.'] is not find in '.get_called_class().', you must config it! ');
}
- in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\Application.php at line 67 – fecshop\services\Application::getChildService('image')
616263646566676869 * @property $attr | String , service的name。
- 魔术方法,当调用一个属性,对象不存在的时候就会执行该方法,然后
- 根据构造方法注入的配置,实例化service对象。
*/
public function __get($attr)
{
return $this->getChildService($attr);
}
}
in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\product\Image.php at line 69 – fecshop\services\Application::__get('image')
63646566676869707172737475
/**
- 通过产品图片的相对路径得到产品图片的url.
*/
protected function actionGetUrl($str)
{
return Yii::$service->image->GetImgUrl($this->imageFloder.$str, 'common');
}
/**
- 通过产品图片的相对路径得到产品图片的绝对路径.
*/
protected function actionGetDir($str)
- fecshop\services\product\Image::actionGetUrl('/default.jpg')
in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\Service.php at line 49 – call_user_func_array([fecshop\services\product\Image, 'actionGetUrl'], ['/default.jpg'])
43444546474849505152535455 } else {
$method = 'action'.ucfirst($originMethod);
$this->_callFuncLog[$originMethod] = $method;
}
if (method_exists($this, $method)) {
$this->beginCall($originMethod, $arguments);
$return = call_user_func_array([$this, $method], $arguments);
$this->endCall($originMethod, $arguments);
return $return;
} else {
throw new InvalidCallException('fecshop service method is not exit. '.get_class($this)."::$method");
}
in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\product\Image.php at line 103 – fecshop\services\Service::__call('getUrl', ['/default.jpg'])
979899100101102103104105106107108109 /**
获取产品默认图片的完整URL
*/
protected function actionDefautImg()
{
if (!$this->_defaultImg) {
$this->_defaultImg = $this->getUrl($this->defaultImg);
}
return $this->_defaultImg;
}
/**
- fecshop\services\product\Image::actionDefautImg()
in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\Service.php at line 49 – call_user_func_array([fecshop\services\product\Image, 'actionDefautImg'], [])
43444546474849505152535455 } else {
$method = 'action'.ucfirst($originMethod);
$this->_callFuncLog[$originMethod] = $method;
}
if (method_exists($this, $method)) {
$this->beginCall($originMethod, $arguments);
$return = call_user_func_array([$this, $method], $arguments);
$this->endCall($originMethod, $arguments);
return $return;
} else {
throw new InvalidCallException('fecshop service method is not exit. '.get_class($this)."::$method");
}
- in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\category\Product.php at line 90 – fecshop\services\Service::__call('defautImg', [])
84858687888990919293949596 /**
- fecshop\services\category\Product::actionConvertToCategoryInfo([])
in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\Service.php at line 49 – call_user_func_array([fecshop\services\category\Product, 'actionConvertToCategoryInfo'], [[]])
43444546474849505152535455 } else {
$method = 'action'.ucfirst($originMethod);
$this->_callFuncLog[$originMethod] = $method;
}
if (method_exists($this, $method)) {
$this->beginCall($originMethod, $arguments);
$return = call_user_func_array([$this, $method], $arguments);
$this->endCall($originMethod, $arguments);
return $return;
} else {
throw new InvalidCallException('fecshop service method is not exit. '.get_class($this)."::$method");
}
in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\app\appfront\modules\Cms\block\home\Index.php at line 50 – fecshop\services\Service::__call('convertToCategoryInfo', [[]])
44454647484950515253545556 'special_from', 'special_to',
'url_key', 'score',
];
$filter['where'] = ['in', 'sku', $skus];
$products = Yii::$service->product->getProducts($filter);
//var_dump($products);
$products = Yii::$service->category->product->convertToCategoryInfo($products);
return $products;
}
}
public function initHead()
in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\app\appfront\modules\Cms\block\home\Index.php at line 28 – fecshop\app\appfront\modules\Cms\block\home\Index::getProductBySkus(['men0003', 'men0002', 'men0001', 'computer001-xinghao2-cpu3', ...])
22232425262728293031323334 }
public function getFeaturedProduct()
{
$featured_skus = Yii::$app->controller->module->params['homeFeaturedSku'];
return $this->getProductBySkus($featured_skus);
}
public function getBestSellerProducts()
{
$bestSellSkus = Yii::$app->controller->module->params['homeBestSellerSku'];
in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\app\appfront\modules\Cms\block\home\Index.php at line 19 – fecshop\app\appfront\modules\Cms\block\home\Index::getFeaturedProduct()
13141516171819202122232425 public function getLastData()
{
$this->initHead();
// change current layout File.
//Yii::$service->page->theme->layoutFile = 'home.php';
return [
'bestFeaturedProducts' => $this->getFeaturedProduct(),
'bestSellerProducts' => $this->getBestSellerProducts(),
];
}
public function getFeaturedProduct()
{
in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\app\appfront\modules\Cms\controllers\HomeController.php at line 19 – fecshop\app\appfront\modules\Cms\block\home\Index::getLastData()
13141516171819202122232425 parent::init();
}
// 网站信息管理
public function actionIndex()
{
$data = $this->getBlock()->getLastData();
return $this->render($this->action->id, $data);
}
public function behaviors()
{
- fecshop\app\appfront\modules\Cms\controllers\HomeController::actionIndex()
- in D:\wamp\www\wordpress\vendor\yiisoft\yii2\base\InlineAction.php at line 57 – call_user_func_array([fecshop\app\appfront\modules\Cms\controllers\HomeController, 'actionIndex'], [])
- in D:\wamp\www\wordpress\vendor\yiisoft\yii2\base\Controller.php at line 157 – yii\base\InlineAction::runWithParams([])
- in D:\wamp\www\wordpress\vendor\yiisoft\yii2\base\Module.php at line 528 – yii\base\Controller::runAction('index', [])
- in D:\wamp\www\wordpress\vendor\yiisoft\yii2\web\Application.php at line 103 – yii\base\Module::runAction('cms/home/index', [])
- in D:\wamp\www\wordpress\vendor\yiisoft\yii2\base\Application.php at line 386 – yii\web\Application::handleRequest(fecshop\yii\web\Request)
- in D:\wamp\www\wordpress\appfront\web\index.php at line 87 – yii\base\Application::run()
81828384858687 上面的例子就是获取cms服务的子服务article。
/
new fecshop\services\Application($config['services']);
unset($config['services']);
$application = new yii\web\Application($config);
$application->run();
$_COOKIE = [