Guest User

Untitled

a guest
Jan 21st, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.39 KB | None | 0 0
  1. <?php
  2. class Post extends CActiveRecord
  3. {
  4.     public static function model($className=__CLASS__)
  5.     {
  6.         return parent::model($className);
  7.     }
  8.  
  9.     public function tableName()
  10.     {
  11.         return 'post';
  12.     }
  13.  
  14.     public function relations()
  15.     {
  16.         return array(
  17.             'comments'=>array(self::HAS_MANY,'Comment',array('post_id'=>'id')),
  18.             'user'=>array(self::BELONGS_TO,'User',array('user_id'=>'id')),
  19.         );
  20.     }
  21. }
Add Comment
Please, Sign In to add comment