404 when module definition as the same as the controller

Hum. Example:

http://localhost/imoveis/index.php?r=imovel/imovel

I have a module called Imovel and a controller ImovelCOntroller


Page Not Found

Unable to resolve the request "imovel/imovel".


The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.


If you think this is a server error, please contact the webmaster. 

Am I doing it wrong?

This implies you have a model called imovel with a controller that has an action called imovel.

You should have these files:

application/models/Imovel.php

application/controllers/ImovelController.php

Inside ImovelController.php you should have public function actionImovel() as that is what that url should resolve to.

Is this right?

NO.

r=imovel/imovelimplies that you have a controller called ImovelController.php and inside that controller an action called actionImovel.

Same difference. I don’t really see why this isn’t working. I believe you can just add any actionNEWACTION function to your controller and then reference it by controller/NEWACTION. You might also try creating the action outside the controller class by extending CAction like follows:

controllers/yourcontroller/NEWACTION.php




class NEWACTION extends CAction

{

  public function run()

  {

     ...

  }

}



then Controller->actions()




return array( 

  'newaction' => 'application.controllers.yourcontroller.NEWACTION',

);



Just a thought. Maybe someone else can answer why just having the actionNEWACTION() function isn’t working.

Did you have configured CUrlManager in some way?

Did you list ‘imovel’ in the ‘modules’ property in the app config?

Nah, haven’t had to mess with that. Do all the other actions in your controller work?

If you add




public function actionSayHello(){ echo 'Hello'; }



to your controller, does index.php?r=yourcontroller/sayHello work?

you know, this caught me, but i thought it was a typo. are we really talking about a module or a model? if you actually meant module, then i’m sorry.

I meant module. Model has nothing to do with URL resolution.

Hello and thanks for all.

Yes Qiang, I had defined my module in modules property.

I was filling my form and submiting some data. When navegating I noticed I wasn`t able to access my imovel module "functions" anymore, it was just working fine before.

I Didn’t have changed CUrlManager