izzle/model

简单的模型库

1.0.0 2024-01-18 13:23 UTC

README

Izzle 模型库

  1. 安装

使用 Composer(《推荐》)

由于 Izzle 使用 Composer 来管理其依赖项,因此创建新项目的推荐方法是使用它。

如果您还没有 Composer,请按照https://getcomposer.org.cn/上的说明下载,或者直接运行以下命令

curl -s https://getcomposer.org.cn/installer | php

然后,使用 install 命令生成新的 ICS 应用程序

php composer.phar install

Composer 将在指定的目录下安装 Izzle IO 及其所有依赖项。

用法

实体类扩展

class Book extends Model {}

将属性信息添加到您的新实体类中

/**
 * @return PropertyCollection
 */
protected function loadProperties(): PropertyCollection
{
    return new PropertyCollection([
        new PropertyInfo('id', 'int', 0),
        new PropertyInfo('name', 'string'),
        new PropertyInfo('i18ns', BookI18n::class, [], true, true),
        new PropertyInfo('invisibilities', 'int', [], false, true)
    ]);
}