3

I am new in Yii Framework. I am doing one small correction in Yii framework web app. Their third party Fax(Fax.de) API providers change something, I am trying to change the code, but I couldn't get the right file.

If the URL is www.example.com/paymentoption. What controller will work and where can I get Route folder?

Please help me...

fgamess
  • 1,276
  • 2
  • 13
  • 25
AK INFOPARK
  • 31
  • 1
  • 3
  • Besides the below answers, you should check your app config file about some `urlManager` `rule` that could be redirecting your `paymentoption` to any other place else than 'conventional' place. – sdlins Jul 06 '18 at 02:52

3 Answers3

3

in yii there is no route folder or file. From Url you can simply find the controller named paymentoption. and in that you can find the method actionIndex which is called by Default

Janki Rathod
  • 107
  • 6
2

From documentation:

Routing involves two steps:

the incoming request is parsed into a route and the associated query parameters; a controller action corresponding to the parsed route is created to handle the request. When using the default URL format, parsing a request into a route is as simple as getting the value of a GET query parameter named r.

When using the pretty URL format, the URL manager will examine the registered URL rules to find matching one that can resolve the request into a route. If such a rule cannot be found, a yii\web\NotFoundHttpException exception will be thrown.

Once the request is parsed into a route, it is time to create the controller action identified by the route. The route is broken down into multiple parts by the slashes in it. For example, site/index will be broken into site and index. Each part is an ID which may refer to a module, a controller or an action.

In this case, the link: www.example.com/paymentoption will use the controller PaymentoptionController and actionIndex, or it could be a module.

I recommend reading the documentation on the part of the Routing and Url manager: https://www.yiiframework.com/doc/guide/2.0/en/runtime-routing

FeR-S
  • 339
  • 2
  • 15
1

Yii is a conventional based framework. That is, You should follow certain naming conventions to create your component.

For example. Your controller should be

    SomenameController

Notice, above controller name has naming convention Controller adjoined to Somename

Here, You don't have folder to router, but controllers

     //Get controller name
     echo Yii::$app->controller->id

You can find a controller with that name in your controllers folder.

Hearaman
  • 8,466
  • 13
  • 41
  • 58