library common
Common tools for uniondrug/framework
uniondrug/common
Common tools for uniondrug/framework
- Tuesday, March 6, 2018
- by wsfuyibing
- Repository
- 2 Watchers
- 0 Stars
- 7 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 5 Versions
- 0 % Grown
uniondrug/common 框架通用功能
安装
composer require uniondrug/common
目录结构
/ vendor/uniondrug/common/src
├── Controllers
│ ├── ServiceClientController.php // Service客户端
│ ├── ServiceServerController.php // Service服务端
│ └── TestsController.php // 单元测试调度
├── Helpers
│ ├── ImageSize.php
│ ├── Session.php
│ ├── SessionClient.php
│ └── SessionData.php
├── Interfaces
│ ├── RelateChildInterface.php
│ ├── RelateFetchInterface.php
│ ├── RelateWriteInterface.php
│ ├── SingleChildInterface.php
│ ├── SingleFetchInterface.php
│ └── SingleWriteInterface.php
├── Services
│ ├── FrameworkService.php
│ ├── RelateChildService.php
│ ├── RelateService.php
│ ├── SingleChildService.php
│ └── SingleService.php
微服务用法
Helpers
Interfaces
Services
Service继承, 基于接口RelateChildInterface
、RelateFetchInterface
、RelateWriteInterface
、SingleChildInterface
、SingleFetchInterface
、SingleWriteInterface
预定义的通用Service。, (*1)
<?php
/**
* 示例Service
* @author wsfuyibing <websearch@163.com>
* @date 2017-11-17
*/
namespace App\Services;
use Pails\Services\RelateChildService;
/**
* 示例Service应用场景
* 1. 有隶属关系
* 2. 有上/下级
* @package App\Services
*/
class ExampleService extends RelateChildService
{
}
-
Phalcon\Di\Injectable{}, (*2)
__get()
getDI()
getEventsManager()
setDI()
setEventsManager()
-
Pails\Services\FrameworkService{}, (*3)
-
fetchAll()
- 按条件读取全部
-
fetchCount()
- 按条件读取数量
-
fetchOne()
- 按条件读取一条
-
fetchPaging()
- 按条件读取分页
-
getAutoIncrementColumn()
- 读取模型的流水号ID字段名称
-
getError()
- 读取最的的错误
-
getErrorMessage()
- 读取最近的错误原因
-
getModel()
- 读取Service对应的Model
-
hasError()
- 检查是否有错误
-
setError()
- 设置最近的错误
-
setModel()
- 设置Service对应的Model, 若不指定则自动识别
-
Pails\Services\SingleService{}, (*4)
-
delete()
- 批量删除
-
deleteById()
- 按ID删除
-
fetchAllByColumn()
- 按指定字段读取全部
-
fetchOneByColumn()
- 按指定字段读取一条
-
fetchOneById()
- 按ID读取一条
-
insert()
- 添加新记录
-
update()
- 修改记录
-
updateById()
- 按记录ID修改
-
Pails\Services\SingleChildService{}, (*5)
-
fetchChild()
- 读取一条下级记录
-
fetchChildren()
- 读取下级记录列表
-
fetchTree()
- 读取树形结构
-
hasChild()
- 检查是否有下级记录
-
Pails\Services\RelateService{}, (*6)
-
delete()
- 批量删除
-
deleteById()
- 按ID删除
-
fetchAllByColumn()
- 按指定字段读取全部
-
fetchOneByColumn()
- 按指定字段读取一条
-
fetchOneById()
- 按ID读取一条
-
insert()
- 添加新记录
-
update()
- 修改记录
-
updateById()
- 按记录ID修改
-
Pails\Services\RelateChildService{}, (*7)
-
fetchChild()
- 读取一条下级记录
-
fetchChildren()
- 读取下级记录列表
-
fetchTree()
- 读取树形结构
-
hasChild()
- 检查是否有下级记录
dev-master
9999999-dev
Common tools for uniondrug/framework
Sources
Download
MIT
The Requires
by
UnionDrug R&D
2.1
2.1.0.0
Common tools for uniondrug/framework
Sources
Download
MIT
The Requires
by
UnionDrug R&D
2.x-dev
2.9999999.9999999.9999999-dev
Common tools for uniondrug/framework
Sources
Download
MIT
The Requires
by
UnionDrug R&D
2.0
2.0.0.0
Common tools for uniondrug/framework
Sources
Download
MIT
The Requires
by
UnionDrug R&D
1.0
1.0.0.0
Common tools for uniondrug/framework
Sources
Download
MIT
The Requires
by
UnionDrug R&D