KeepLearning Posted March 18, 2013 Share Posted March 18, 2013 Version 0.5 Page 150 Larry, Can you please break this paragraph down or explain it another way? I've read it and re-read it numerous times. I understand the preceding and following pages, but not this paragraph and example. Thanks. "However, when you’ve identified a parameter in a rule that’s not part of the route, it will only be passed to an action if that action’s parameter is named the same. The earlier example code works, but this action definition with that same rule will throw an exception (Figure 7.1): # protected/controllers/PageController.php public function actionView($x) { // Etc." Link to comment Share on other sites More sharing options...
Larry Posted March 18, 2013 Share Posted March 18, 2013 If you have a parameter in a routing rule, the action method's parameter has to use the same name. For example, the rule before this code, I believe, uses "id" as the parameter (for the page ID). So the actionView() method has to use $id for its parameter: public function actionView($id) { Using $x in the method definition, when the routing rule uses "id", throws an exception. 1 Link to comment Share on other sites More sharing options...
Recommended Posts