Jump to content
Larry Ullman's Book Forums

yang2007chun

Members
  • Content Count

    3
  • Joined

  • Last visited

Everything posted by yang2007chun

  1. Thank you Antonio.1. I have tried PDO::FETCH_OBJ, it returns an stdClass Object. And it works 2. I tried $model['title'] with PDO::FETCH_CLASS , it won't work, since $model is a Page AR object. What I want to get is a Page AR object with correct properties using DAO(I know how to do the same thing using AR instead of DAO). Since Larry mentioned DAO has "the ability to fetch into specific object types". And I really want to make it work ,but did not get the right answer . Again, thank you!
  2. Hi Larry, When I test the DAO in your book: (page 186) $q = 'SELECT * FROM page WHERE id=1'; $cmd = Yii::app()->db->createCommand($q); $cmd->setFetchMode(PDO::FETCH_CLASS, 'Page'); $model = $cmd->queryRow(); // Use $model->title et al. I can not retrieve $model->title which is null. Also, I use $model-> attributes, the result is : Array ( [live] => 0 [id] => [user_id] => [title] => [content] => [date_updated] => [date_published] => ) Strangely, only 'live' is not null. The expected result is: Array ( [id] => 1 [user_id] => 1 [
  3. I think there is a mistake at page 65: When you create page table, the date_entered index should followed by (date_published ASC) instead of (date_entered ASC). If I am wrong, please tell me. Thank you!
×
×
  • Create New...