harp-orm/nested

对于 Harp ORM 的邻接列表(parentId 列)

0.3.0 2014-07-14 07:23 UTC

This package is auto-updated.

Last update: 2024-09-21 21:21:57 UTC


README

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version

对于 Harp ORM 的邻接列表(parentId 列)

使用说明

将特性添加到您的模型中

// Model Class
use Harp\Nested\NestedTrait;

class Category extends AbstractModel
{
    use NestedTrait;

    public static function initialize($config)
    {
        NestedTrait::initialize($config);

        // Other initializations
        // ...
    }
}

数据库表

┌─────────────────────────┐
│ Table: Category         │
├─────────────┬───────────┤
│ id          │ ingeter   │
│ name        │ string    │
│ parentId*   │ integer   │
└─────────────┴───────────┘
* Required fields

方法

它将为仓库添加 "parent" 和 "children" Rels。模型将获得便捷方法

许可证

版权 (c) 2014, Clippings Ltd. 由 Ivan Kerin 开发

在 BSD-3-Clause 许可证下,请阅读 LICENSE 文件。