Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F70197042
PhabricatorRepositoryRefCursorQuery.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
Fri, Jul 5, 17:14
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Jul 7, 17:14 (2 d)
Engine
blob
Format
Raw Data
Handle
18804911
Attached To
rPH Phabricator
PhabricatorRepositoryRefCursorQuery.php
View Options
<?php
final
class
PhabricatorRepositoryRefCursorQuery
extends
PhabricatorCursorPagedPolicyAwareQuery
{
private
$repositoryPHIDs
;
private
$refTypes
;
public
function
withRepositoryPHIDs
(
array
$phids
)
{
$this
->
repositoryPHIDs
=
$phids
;
return
$this
;
}
public
function
withRefTypes
(
array
$types
)
{
$this
->
refTypes
=
$types
;
return
$this
;
}
protected
function
loadPage
()
{
$table
=
new
PhabricatorRepositoryRefCursor
();
$conn_r
=
$table
->
establishConnection
(
'r'
);
$data
=
queryfx_all
(
$conn_r
,
'SELECT * FROM %T r %Q %Q %Q'
,
$table
->
getTableName
(),
$this
->
buildWhereClause
(
$conn_r
),
$this
->
buildOrderClause
(
$conn_r
),
$this
->
buildLimitClause
(
$conn_r
));
return
$table
->
loadAllFromArray
(
$data
);
}
public
function
willFilterPage
(
array
$refs
)
{
$repository_phids
=
mpull
(
$refs
,
'getRepositoryPHID'
);
$repositories
=
id
(
new
PhabricatorRepositoryQuery
())
->
setViewer
(
$this
->
getViewer
())
->
setParentQuery
(
$this
)
->
withPHIDs
(
$repository_phids
)
->
execute
();
$repositories
=
mpull
(
$repositories
,
null
,
'getPHID'
);
foreach
(
$refs
as
$key
=>
$ref
)
{
$repository
=
idx
(
$repositories
,
$ref
->
getRepositoryPHID
());
if
(!
$repository
)
{
unset
(
$refs
[
$key
]);
continue
;
}
$ref
->
attachRepository
(
$repository
);
}
return
$refs
;
}
private
function
buildWhereClause
(
AphrontDatabaseConnection
$conn_r
)
{
$where
=
array
();
if
(
$this
->
repositoryPHIDs
)
{
$where
[]
=
qsprintf
(
$conn_r
,
'repositoryPHID IN (%Ls)'
,
$this
->
repositoryPHIDs
);
}
if
(
$this
->
refTypes
)
{
$where
[]
=
qsprintf
(
$conn_r
,
'refType IN (%Ls)'
,
$this
->
refTypes
);
}
$where
[]
=
$this
->
buildPagingClause
(
$conn_r
);
return
$this
->
formatWhereClause
(
$where
);
}
public
function
getQueryApplicationClass
()
{
return
'PhabricatorApplicationDiffusion'
;
}
}
Event Timeline
Log In to Comment