Index: trunk/extensions/CodeReview/backend/CodeComment.php |
— | — | @@ -28,6 +28,36 @@ |
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
| 32 | + * Create a comment given its id AND a repository |
| 33 | + * @param int $cc_id Comment ID in the database |
| 34 | + * @param CodeRevision $rev A revision object to which the comment is |
| 35 | + * attached |
| 36 | + */ |
| 37 | + static function newFromID( $cc_id, CodeRevision $rev ) { |
| 38 | + $dbr = wfGetDB( DB_SLAVE ); |
| 39 | + $row = $dbr->selectRow( 'code_comment', |
| 40 | + array( |
| 41 | + # fields needed to build a CodeRevision |
| 42 | + 'cc_rev_id', |
| 43 | + 'cc_repo_id', |
| 44 | + |
| 45 | + # fields needed for self::newFromRow() |
| 46 | + 'cc_id', |
| 47 | + 'cc_text', |
| 48 | + 'cc_user', |
| 49 | + 'cc_user_text', |
| 50 | + 'cc_patch_line', |
| 51 | + 'cc_timestamp', |
| 52 | + 'cc_review', |
| 53 | + 'cc_sortkey' |
| 54 | + ), |
| 55 | + array( 'cc_id' => (int) $cc_id ), |
| 56 | + __METHOD__ |
| 57 | + ); |
| 58 | + return self::newFromRow( $rev, $row ); |
| 59 | + } |
| 60 | + |
| 61 | + /** |
32 | 62 | * @param $rev Revision |
33 | 63 | * @param $data array |
34 | 64 | * @return CodeComment |