Jump to content
Larry Ullman's Book Forums

The Loadmodel Controller Method: Which Table Will Be Searched?


Recommended Posts

Version 0.5


Loading a Single Model


The following two examples work together. The second calls the first. I believe the purpose is to retrieve a record from a table. And I believe each occurrence of $id represents the primary key value of the particular record we want.


My question is, how do these functions know which table to search in? 


page 136:


public function loadModel($id) {
$model = Page::model()->findByPk($id);
if ($model===null) {
throw new CHttpException(404, 'The requested page
does not exist.');
Page 139:
public function actionView($id){
Link to comment
Share on other sites


  • Create New...