bvfbarten/f3-model
Composer 安装命令:
composer require bvfbarten/f3-model
包简介
Simple model class for f3 framework
README 文档
README
F3 Model strives to create lazy loading relations the fatfree way. It comes with four functions to add to the mapper object.
class UserGroup extends F3Model {
public $_db = 'db';
public $_table = 'user_group';
public function relations() {
return [
'User' => [
"User",
['id = ?', $this->user_id]
],
'Group' => [
"Group",
['id = ?', $this->group_id]
],
'NotFamily' => [
"Group",
['id != ? and name = ?', 3, 'family']
],
];
}
}
$userGroup = new UserGroup;
$user = $userGroup->loadRelation('User');
function findRelation($key, $where, $args) { }
returns array of NotFamily relationship
$where, gives ability to add additional where parameters to related table in same fashion as f3
$args, allows overriding $args given in initial relations function
function loadRelation($key, $where, $args) { }
returns a single object of NotFamily
function countRelation($key, $where, $args) { }
returns a count of NotFamily
function combineFilter($filter, $filter1) { } returns an f3 filter combining $filter and $filter1
统计信息
- 总下载量: 54
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2021-04-13