提交 9a5043d7 编写于 作者: T Terry

category services

上级 5af8b601
......@@ -27,7 +27,7 @@ class Category extends Service
* $storagePrex , $storage , $storagePath 为找到当前的storage而设置的配置参数
* 可以在配置中更改,更改后,就会通过容器注入的方式修改相应的配置值
*/
public $storage = 'CategoryMysqldb'; // CategoryMongodb | CategoryMysqldb 当前的storage,如果在config中配置,那么在初始化的时候会被注入修改
public $storage = 'CategoryMongodb'; // CategoryMongodb | CategoryMysqldb 当前的storage,如果在config中配置,那么在初始化的时候会被注入修改
/**
* 设置storage的path路径,
......@@ -58,7 +58,22 @@ class Category extends Service
}
*/
}
// 动态更改为mongodb model
public function changeToMongoStorage()
{
$this->storage = 'CategoryMongodb';
$currentService = $this->getStorageService($this);
$this->_category = new $currentService();
}
// 动态更改为mongodb model
public function changeToMysqlStorage()
{
$this->storage = 'CategoryMysqldb';
$currentService = $this->getStorageService($this);
$this->_category = new $currentService();
}
protected function actionGetCategoryEnableStatus()
{
return $this->_category->getCategoryEnableStatus();
......@@ -140,21 +155,7 @@ class Category extends Service
}
// 动态更改为mongodb model
public function changeToMongoStorage()
{
$this->storage = 'CategoryMongodb';
$currentService = $this->getStorageService($this);
$this->_category = new $currentService();
}
// 动态更改为mongodb model
public function changeToMysqlStorage()
{
$this->storage = 'CategoryMysqldb';
$currentService = $this->getStorageService($this);
$this->_category = new $currentService();
}
/**
* 得到分类的树数组。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册