thecodingmachine/tdbm-fluid-schema-builder
Composer 安装命令:
composer require thecodingmachine/tdbm-fluid-schema-builder
包简介
Build and modify your database schema used by TDBM using a fluid syntax.
README 文档
README
Fluid schema builder for TDBM
Build and modify your database schema using DBAL and a fluid syntax. This project allows you to tailor your database schema to TDBM (it will allow you to easily add annotations that TDBM can read).
It is a super-set of dbal-fluid-schema-builder.
If you don't know dbal-fluid-schema-builder, check the documentation first.
Why?
TDBM can read a number of annotations in the schema comments (see TDBM annotations documentation).
This library allows to write these annotations using functions added to the "dbal-fluid-schema-builder".
What's added?
$db = new TdbmFluidSchema($schema); // Customize the name of the Bean class $posts = $db->table('posts')->customBeanName('Article'); // You can pass a new 'v1' or 'v4' parameter to uuid(). // This will generate a @UUID TDBM annotation that will help TDBM autogenerate the UUID $posts = $db->table('posts')->uuid('v4'); // Customize the visibility of a column $db->table('posts') ->column('user_id')->references('users') ->protectedGetter() // The Post.getUser() method is protected ->protectedSetter() // The Post.setUser() method is protected ->protectedOneToMany() // The User.getPosts() method is protected // Customize implemented interfaces $db->table('posts') ->implementsInterface('App\\PostInterface') // The generated bean will implement interface App\\PostInterface ->implementsInterfaceOnDao('App\\PostDaoInterface'); // The generated DAO will implement interface App\\PostDaoInterface // The "posts" table will generate a GraphQL type (i.e. the bean will be annotated with the GraphQLite @Type annotation). $posts = $db->table('posts')->graphqlType(); // You can pass a new 'v1' or 'v4' parameter to uuid(). // This will generate a @UUID TDBM annotation that will help TDBM autogenerate the UUID $posts = $db->table('posts')->column('title')->string(50)->graphqlField() // The column is a GraphQL field ->fieldName('the_title') // Let's set the name of the field to a different value ->logged() // The user must be logged to view the field ->right('CAN_EDIT') // The user must have the 'CAN_EDIT' right to view the field ->failWith(null) // If the user is not logged or has no right, let's serve 'null' ->endGraphql(); // You can pass instructions on how JSON serialization occurs. // This will generate a set of JSONxxx annotations. $nodes = $db->table('nodes') ->column('id')->integer()->primaryKey()->autoIncrement()->jsonSerialize()->ignore() ->column('alias_id')->references('nodes')->null()->jsonSerialize()->recursive() ->column('parent_id')->references('nodes')->null()->jsonSerialize()->include() ->column('root_id')->references('nodes')->null()->jsonSerialize()->ignore() ->column('owner_id')->references('authors')->null()->jsonSerialize()->formatUsingProperty('name')->include() ->column('owner_country')->references('authors')->null()->jsonSerialize()->formatUsingMethod('getCountryName')->include() ->column('name')->string()->jsonSerialize()->key('basename') ->column('size')->integer()->notNull()->default(0)->jsonSerialize()->numericFormat(null, null, null, ' o') ->column('weight')->float()->null()->jsonSerialize()->numericFormat(2, ',', '.', 'g') ->column('created_at')->date()->null()->jsonSerialize()->datetimeFormat("Y-m-d") ->column('another_parent')->references('nodes')->comment('@JsonCollection("entries") @JsonFormat(property="entry")'); $db->junctionTable('posts', 'users')->graphqlField(); // Expose the many-to-many relationship as a GraphQL field.
thecodingmachine/tdbm-fluid-schema-builder 适用场景与选型建议
thecodingmachine/tdbm-fluid-schema-builder 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 112.69k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 03 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 thecodingmachine/tdbm-fluid-schema-builder 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 thecodingmachine/tdbm-fluid-schema-builder 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 112.69k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 28
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-03-11