File tree 1 file changed +8
-9
lines changed
1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change 10
10
11
11
namespace fecshop \services ;
12
12
13
+ use fecshop \services \product \ProductMongodb ;
14
+ use fecshop \services \product \ProductMysqldb ;
13
15
use yii \base \InvalidCallException ;
14
16
use yii \base \InvalidConfigException ;
15
17
use Yii ;
@@ -35,23 +37,20 @@ class Product extends Service
35
37
* 如果设置了路径,则使用自定义的路径
36
38
*/
37
39
public $ storagePath = '' ;
40
+ /**
41
+ * @var ProductMongodb | ProductMysqldb 根据 $storage 及 $storagePath 配置的 Product 的实现
42
+ */
38
43
protected $ _product ;
44
+ /**
45
+ * @var string 默认属性组名称
46
+ */
39
47
protected $ _defaultAttrGroup = 'default ' ;
40
48
41
49
public function init ()
42
50
{
43
51
parent ::init ();
44
52
$ currentService = $ this ->getStorageService ($ this );
45
53
$ this ->_product = new $ currentService ();
46
- /*
47
- if ($this->storage == 'mongodb') {
48
- // 根据配置注入的config值,返回相应的class,譬如:\fecshop\services\product\ProductMongodb
49
- $currentService = $this->getStorageService($this);
50
- $this->_product = new $currentService();
51
- //}else if($this->storage == 'mysqldb'){
52
- //$this->_category = new CategoryMysqldb;
53
- }
54
- */
55
54
}
56
55
57
56
You can’t perform that action at this time.
0 commit comments