Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Post extends CActiveRecord
- {
- public static function model($className=__CLASS__)
- {
- return parent::model($className);
- }
- public function tableName()
- {
- return 'post';
- }
- public function relations()
- {
- return array(
- 'comments'=>array(self::HAS_MANY,'Comment',array('post_id'=>'id')),
- 'user'=>array(self::BELONGS_TO,'User',array('user_id'=>'id')),
- );
- }
- }
Add Comment
Please, Sign In to add comment