Yii Rest api url manager -


I can not logic behind the url manager. Can any body tell about the URL of the rest of the pattern? I have several ways in my controller with single parameters

This is my original URL: Localhost / Project / API / Event / Gate Event / Event_ID / 1

The API is module event The name of the controller getevent controller action is event_id parameter 1

I want to update the remaining pattern local celebrity / project / API / event / 1

// to change it.

All belong to the same model ............

 < Code> // Event ID Public Work Search by SearchAirventEd () {$ model-> ByEventID (); } // User ID Recover User Events by Public Function ActionUIIDID () {$ Model-> User avent (); } // Code Search for Events by Public Function EventEventcode () {$ Model-> Eventode ();  

Add this rule:

  ' Api / & lt; Controller: \ w + & gt; / & LT; Action: \ w + & gt; / & LT; ID: \ d +> '= & Gt; 'API / & LT; Controller & gt; / By & lt; Action & gt; '  

and $ id add your actions:

  public function operations and idid ($ id) {} ​​public function Action user ($ id) {} ​​ 

Now if you call localhst / project / api / event / eventid / 1 then in Yii actionByEventId will call your event - with the $ id plus 1


Comments