mezon / fields-set
类型字段集
1.0.6
2021-11-18 16:42 UTC
Requires
- php: >=7.2.0
Requires (Dev)
- phpunit/phpunit: ^8.5
- vimeo/psalm: ^4.2
README
简介
在某些情况下,您可能需要存储一组类型字段。因此,这个类正好符合您的需求。
安装
只需打印
composer require mezon/fields-set
创建
创建过程非常简单
$fieldsSet = new \Mezon\FieldsSet([ 'id' => [ 'type' => 'int', 'title' => 'id of the record' ], 'title' => [ 'type' => 'string', 'title' => 'some title' ], 'description' => [ 'type' => 'string', 'title' => 'quite obvious yeah?)' ] ]);
参考
方法返回集合中的所有字段
public function getFields(): array
方法验证字段是否存在于我们的集合中
public function hasField(string $fieldName): bool
方法以数组形式返回字段名称列表
public function getFieldsNames(): array