简体   繁体   English

Zend Framework:表单:是否应该将camelCase用于表单元素名称和数据库表?

[英]Zend Framework: Form: Should I use camelCase for form element names & DB tables, or not?

I like everything to be neat and semantic, therefore I am reaching out for some advice on a subject I am 50/50 on, I realise this is pretty much down to personal preference but want to stick to doing things one way. 我喜欢一切都整洁和语义化,因此我正在寻求50/50主题的一些建议,我意识到这很大程度上取决于个人喜好,但希望坚持以一种方式做事。

Note: I know this question has been asked before, but the answers are very mixed and usually boil down to... stick to the convention being used in the application. 注意:我知道这个问题以前曾被问过,但是答案很复杂,通常归结为...遵守应用程序中使用的约定。 But when creating a new application, whats the best way to do it? 但是,在创建新应用程序时,最好的方法是什么?

The database columns look like: 数据库列如下所示:

description, user_id, blah_id 说明,user_id,blah_id

Therefore should my form elements look like: 因此,我的表单元素应如下所示:

Option 1: $userId = new Zend_Form_Element_Select(' user_id '); 选项1:$ userId = new Zend_Form_Element_Select(' user_id ');

OR 要么

option 2: $userId = new Zend_Form_Element_Select(' userId '); 选项2:$ userId = new Zend_Form_Element_Select(' userId ');

OR: 要么:

Change the (MySQL) database to include camelCase tables and columns too?? 更改(MySQL)数据库,使其也包含camelCase表和列?

What are your thoughts on this? 您对此有何想法?

Zend Framework use camelCase. Zend Framework使用camelCase。 So if you can change the naming of tables and column, use this. 因此,如果您可以更改表和列的命名,请使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM