php bin/swoft entity:gen table= table1,table2,table3,...
[root@localhost swoft]# php bin/swoft entity:gen -y 2020/07/14-14:27:30 [INFO] SwoftSwoftApplication:setSystemAlias(417) Project path: @base=/phpwww/wang/swoft 2020/07/14-14:27:30 [INFO] SwoftSwoftApplication:setSystemAlias(418) Set alias @app=@base/app 2020/07/14-14:27:30 [INFO] SwoftSwoftApplication:setSystemAlias(419) Set alias @config=@base/config 2020/07/14-14:27:30 [INFO] SwoftSwoftApplication:setSystemAlias(420) Set alias @runtime=@base/runtime 2020/07/14-14:27:30 [INFO] SwoftProcessorEnvProcessor:handle(60) Env file(/phpwww/wang/swoft/.env) is loaded 2020/07/14-14:27:33 [INFO] SwoftProcessorAnnotationProcessor:handle(45) Annotations is scanned(autoloader 36, annotation 476, parser 93) 2020/07/14-14:27:33 [INFO] SwoftProcessorBeanProcessor:handle(53) Bean is initialized(singleton 333, prototype 80, definition 50) 2020/07/14-14:27:33 [INFO] SwoftProcessorBeanProcessor:handle(57) Config path is /phpwww/wang/swoft/config 2020/07/14-14:27:33 [INFO] SwoftProcessorBeanProcessor:handle(62) Config env is not setting 2020/07/14-14:27:33 [INFO] SwoftProcessorEventProcessor:handle(35) Event manager initialized(66 listener, 4 subscriber) 2020/07/14-14:27:33 [INFO] SwoftWebSocketServerListenerAppInitCompleteListener:handle(44) WebSocket server route registered(module 3, message command 14) 2020/07/14-14:27:33 [INFO] SwoftTcpServerListenerAppInitCompleteListener:handle(45) Tcp server route registered(routes 4) 2020/07/14-14:27:33 [INFO] SwoftErrorListenerAppInitCompleteListener:handle(34) Error manager init completed(4 type, 5 handler, 5 exception) 2020/07/14-14:27:33 [INFO] SwoftProcessorConsoleProcessor:handle(36) Console command route registered (group 14, command 45) Generate entity /phpwww/wang/swoft/app/Model/Entity/Member.php OK!
php bin/swoft entity:gen -y 生成所有
[root@localhost swoft]# php bin/swoft entity:gen -y 2020/07/14-14:28:33 [INFO] SwoftSwoftApplication:setSystemAlias(417) Project path: @base=/phpwww/wang/swoft 2020/07/14-14:28:33 [INFO] SwoftSwoftApplication:setSystemAlias(418) Set alias @app=@base/app 2020/07/14-14:28:33 [INFO] SwoftSwoftApplication:setSystemAlias(419) Set alias @config=@base/config 2020/07/14-14:28:33 [INFO] SwoftSwoftApplication:setSystemAlias(420) Set alias @runtime=@base/runtime 2020/07/14-14:28:33 [INFO] SwoftProcessorEnvProcessor:handle(60) Env file(/phpwww/wang/swoft/.env) is loaded 2020/07/14-14:28:36 [INFO] SwoftProcessorAnnotationProcessor:handle(45) Annotations is scanned(autoloader 36, annotation 476, parser 93) 2020/07/14-14:28:36 [INFO] SwoftProcessorBeanProcessor:handle(53) Bean is initialized(singleton 333, prototype 80, definition 50) 2020/07/14-14:28:36 [INFO] SwoftProcessorBeanProcessor:handle(57) Config path is /phpwww/wang/swoft/config 2020/07/14-14:28:36 [INFO] SwoftProcessorBeanProcessor:handle(62) Config env is not setting 2020/07/14-14:28:36 [INFO] SwoftProcessorEventProcessor:handle(35) Event manager initialized(66 listener, 4 subscriber) 2020/07/14-14:28:36 [INFO] SwoftWebSocketServerListenerAppInitCompleteListener:handle(44) WebSocket server route registered(module 3, message command 14) 2020/07/14-14:28:36 [INFO] SwoftTcpServerListenerAppInitCompleteListener:handle(45) Tcp server route registered(routes 4) 2020/07/14-14:28:36 [INFO] SwoftErrorListenerAppInitCompleteListener:handle(34) Error manager init completed(4 type, 5 handler, 5 exception) 2020/07/14-14:28:36 [INFO] SwoftProcessorConsoleProcessor:handle(36) Console command route registered (group 14, command 45) Generate entity /phpwww/wang/swoft/app/Model/Entity/Member.php OK! Generate entity /phpwww/wang/swoft/app/Model/Entity/TbContent.php OK! Generate entity /phpwww/wang/swoft/app/Model/Entity/TbMenus.php OK!
Usage: bin/swoft entity:create [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
表名 tb_content
[root@localhost swoft]# php bin/swoft entity:create -d swoft --table tb_content --remove_prefix tb
Generate entity /phpwww/wang/swoft/app/Model/Entity/Content.php OK!
[root@localhost swoft]# php bin/swoft entity:create -d swoft --table tb_content --table_prefix tb_ --remove_prefix tb_