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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...