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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章