[Solved] Renaming class file (model, controllder)

Hi,

I understand that Yii has its own naming convention but is it possible to change?

For example, I have a file name :

I want to rename into in order to match coding standard of PEAR.

(Also to the class name "MyModel" to "My_Model")

This will make Yii crash. So how can I fix it or is it possible to do?

Thanks in advance :)

It’s possible…

I changed for 2-3 times the names… but always in pair the model and the controller… so if you change MyModel to My_Model change the controller MyModelController to My_ModelController… and you have to check all your sources (PHP files) and change all the occurrences of MyModel to My_Model…

Oh great! Thanks

I am a bit wonder how those things are connected. So I’ll try :)

It seems work for models but what about controller can I change name …

into…

I tried but it doesn’t work.

Oh… and I mean class name and its file name. For example :- MyClassController.php into My_Class_Controller.php

As I have written you can change MyClassControler to My_ClassController…

Oh… actually you had but in my case I need…


My_Class_Controller

It is a bit differ from yours.

I have another underscore right before “Controller”. Anyway I am annoying too much I know but I’m trying to follow PEAR Coing Standard - Naming Conventions since a class name should has underscore between each words.

Anyway it is not a must if I find out I shouldn’t do it so I won’t. Do you have suggestion about this?

The Yii convention is that a controller is named as <model>Controller… so if you want to use My_Model_Controller than you would have to use the underscore in the URl ex. sitedomain/my_Model_/edit

http://www.yiiframework.com/doc/guide/basics.controller (Route)

Oh… OK I got it.

Thanks :)