Yiic Model table names


I looked for this topic but could not find anything that would answer my question.

I am wondering why the tables names that are used when using the model command with yiic shell have to be CamelCased

I am asking because there are systems where this is not allowed (windows namely) and was wondering if it would not be 'safer' to have table names to be lower case and underscored by default when using the scaffolding tools

I know I an change everything by hand afterwards but the lower cased and underscored table names feel safer and readable at the same time

just wondering :)

Hi thomas.mery, We have an example code like this,


class Post extends CActiveRecord




         * @return string the associated database table name


        public function tableName()


                return 'Post';


Yes, you know you can change this line to

        public function tableName()


                return 'post';


for example. And I think (or heard) the reason is that the table can be seen as the class, and the colum can be seen as the attribute in terms of AR.


as I said I know I can change the default table

was wondering the reason for a convention that might be troublesome for some users

Also when you use model command, you can specify an additional parameter about the table name. Check the help information about 'model' command.

yes I just figured it out

thanks !