swoft-cloud / swoft

🚀 PHP Microservice Full Coroutine Framework
https://swoft.org
Apache License 2.0
5.58k stars 788 forks source link

swoft模型查询数据问题 #1296

Open geekchenzx opened 4 years ago

geekchenzx commented 4 years ago

t通过模型查询出来的数据是小驼峰,能否可以取出下划线形式。如果不能建议添加这个,数据是驼峰很不友好

sakuraovq commented 4 years ago

getArrayableAttributes 这个方法就可以 不用 toArray

geekchenzx commented 4 years ago

getArrayableAttributes这个方法就可以不用 getArrayableAttributes这个方法就可以用模型查询出来的数据字段下划线?

suryluk commented 4 years ago

如果能在 php ./bin/swoft entity:create 中加个参数指定创建的entity字段prop是小驼峰(默认)或是下划线就完美了:)

sakuraovq commented 4 years ago

@chenzx023 是的你试试呢 getArrayableAttributes 查询出来是原始的数据库字段

geekchenzx commented 4 years ago

@sakuraovq 哦哦哦 还不如直接加个注解来控制 下划线或者是驼峰

sakuraovq commented 4 years ago

哈哈