Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Schema:
- Comment:
- tableName: comment
- actAs:
- Timestampable:
- columns:
- id:
- type: integer(4)
- primary: true
- notnull: true
- autoincrement: true
- comment:
- type: string(500)
- user_id:
- type: integer(4)
- story_id:
- type: integer(4)
- video_id:
- type: integer(4)
- relations:
- User:
- local: user_id
- foreign: id
- foreignAlias: Comments
- class: sfGuardUser
- onDelete: cascade
- onUpdate: cascade
- Story:
- local: story_id
- foreign: id
- foreignAlias: StoryComments
- onDelete: cascade
- onUpdate: cascade
- Video:
- local: video_id
- foreign: id
- foreignAlias: VideoComments
- onDelete: cascade
- onUpdate: cascade
- SfGuardUserProfile:
- tableName: sf_guard_user_profile
- columns:
- id:
- type: integer(4)
- primary: true
- notnull: true
- autoincrement: true
- first_name:
- type: string(64)
- last_name:
- type: string(64)
- user_id:
- type: integer(4)
- company:
- type: string(64)
- profile_text:
- type: clob(65535)
- picture:
- type: string(64)
- relations:
- User:
- local: user_id
- class: sfGuardUser
- foreign: id
- foreignAlias: Profile
- onDelete: cascade
- onUpdate: cascade
- foreignType: one
- options:
- type: InnoDB
- sfGuardUser:
- actAs: [Timestampable]
- columns:
- id:
- type: integer(4)
- primary: true
- autoincrement: true
- username:
- type: string(128)
- notnull: true
- unique: true
- algorithm:
- type: string(128)
- default: sha1
- notnull: true
- salt: string(128)
- password: string(128)
- is_active:
- type: boolean
- default: 1
- is_super_admin:
- type: boolean
- default: false
- last_login:
- type: timestamp
- indexes:
- is_active_idx:
- fields: [is_active]
- relations:
- groups:
- class: sfGuardGroup
- local: user_id
- foreign: group_id
- refClass: sfGuardUserGroup
- foreignAlias: Users
- permissions:
- class: sfGuardPermission
- local: user_id
- foreign: permission_id
- refClass: sfGuardUserPermission
- foreignAlias: Users
- Query:
- return $this->createQuery('sc')
- ->leftJoin('sc.User u')
- ->leftJoin('u.Profile p')
- ->where('sc.video_id = ?',$id)
- ->orderBy('sc.created_at DESC')
- ->useResultCache(true,sfConfig::get('app_story_comment_cache'),'comment_'.$id.'_'.$page);
- Html:
- <?php foreach($pager->getResults() as $comment): ?>
- <li><?php echo $comment->getUser()->getProfile()->getDisplayName();?> said at <?php echo $comment->getCreatedAt();?> -
- <?php echo $comment->getComment();?>
- </li>
- <?php endforeach;?>
- Results in 4 queries(one for each of the getProfile()->getDisplayName()
- If you drop off the useResultCache it results in one query, the very first one.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement