swoft 学习之 踩坑笔记(三)

1.数据库 实例自动生成

root@7fc3c9aaefa4:/var/www/swoft# php bin/swoft entity:gen table -h

Usage:
  bin/swoft entity:gen [arguments ...] [options ...]

Global Options:
      --debug      Setting the application runtime debug level(0 - 4)
      --no-color   Disable color/ANSI for message output
  -h, --help       Display help message for application or command
  -V, --version    Display application version information

Arguments:
  table STRING   Database table names

Options:
  --exclude STRING           Expect generate database table entity, alias is 'exc'
  --field_prefix STRING      Database field prefix ,alias is 'fp'
  --path STRING              Generate entity file path (defaults: @app/Model/Entity)
  --pool STRING              Choose default database pool (defaults: db.pool)
  --remove_prefix STRING     Remove table prefix ,alias is 'rp'
  --table STRING             Database table names
  --table_prefix STRING      Like match database table prefix, alias is 'tp'
  --td STRING                Generate entity template path (defaults: @devtool/devtool/resource/template)
  -y STRING                  Auto generate

该命令可以一次生成多个实例,通过对你数据库中 table 的信息读取,然后自动生成一个个实例

生成/更新 指定的 table

其中注意一个地方 就是 参数 table names 之间使用逗号 ‘,’ 隔开

php bin/swoft entity:gen table= table1,table2,table3,...
生成所有的实例
php bin/swoft entity:gen -y
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章