Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F85310155
DifferentialCommentQuery.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Sep 28, 05:35
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Sep 30, 05:35 (1 d, 22 h)
Engine
blob
Format
Raw Data
Handle
21140718
Attached To
rPH Phabricator
DifferentialCommentQuery.php
View Options
<?php
/**
* Temporary wrapper for transitioning Differential to ApplicationTransactions.
*/
final
class
DifferentialCommentQuery
extends
PhabricatorOffsetPagedQuery
{
private
$revisionIDs
;
public
function
withRevisionIDs
(
array
$ids
)
{
$this
->
revisionIDs
=
$ids
;
return
$this
;
}
public
function
execute
()
{
$table
=
new
DifferentialComment
();
$conn_r
=
$table
->
establishConnection
(
'r'
);
$data
=
queryfx_all
(
$conn_r
,
'SELECT * FROM %T %Q %Q'
,
$table
->
getTableName
(),
$this
->
buildWhereClause
(
$conn_r
),
$this
->
buildLimitClause
(
$conn_r
));
$comments
=
$table
->
loadAllFromArray
(
$data
);
// We've moved the actual text storage into DifferentialTransactionComment,
// so load the relevant pieces of text we need.
if
(
$comments
)
{
$this
->
loadCommentText
(
$comments
);
}
return
$comments
;
}
private
function
buildWhereClause
(
AphrontDatabaseConnection
$conn_r
)
{
$where
=
array
();
if
(
$this
->
revisionIDs
)
{
$where
[]
=
qsprintf
(
$conn_r
,
'revisionID IN (%Ld)'
,
$this
->
revisionIDs
);
}
return
$this
->
formatWhereClause
(
$where
);
}
private
function
loadCommentText
(
array
$comments
)
{
$table
=
new
DifferentialTransactionComment
();
$conn_r
=
$table
->
establishConnection
(
'r'
);
$data
=
queryfx_all
(
$conn_r
,
'SELECT * FROM %T WHERE legacyCommentID IN (%Ld) AND changesetID IS NULL'
,
$table
->
getTableName
(),
mpull
(
$comments
,
'getID'
));
$texts
=
$table
->
loadAllFromArray
(
$data
);
$texts
=
mpull
(
$texts
,
null
,
'getLegacyCommentID'
);
foreach
(
$comments
as
$comment
)
{
$text
=
idx
(
$texts
,
$comment
->
getID
());
if
(
$text
)
{
$comment
->
setProxyComment
(
$text
);
}
}
}
}
Event Timeline
Log In to Comment