Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93633965
PhabricatorDashboardPanelQuery.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, Nov 30, 07:50
Size
2 KB
Mime Type
text/x-php
Expires
Mon, Dec 2, 07:50 (2 d)
Engine
blob
Format
Raw Data
Handle
22676374
Attached To
rPH Phabricator
PhabricatorDashboardPanelQuery.php
View Options
<?php
final
class
PhabricatorDashboardPanelQuery
extends
PhabricatorCursorPagedPolicyAwareQuery
{
private
$ids
;
private
$phids
;
private
$archived
;
private
$panelTypes
;
private
$authorPHIDs
;
public
function
withIDs
(
array
$ids
)
{
$this
->
ids
=
$ids
;
return
$this
;
}
public
function
withPHIDs
(
array
$phids
)
{
$this
->
phids
=
$phids
;
return
$this
;
}
public
function
withArchived
(
$archived
)
{
$this
->
archived
=
$archived
;
return
$this
;
}
public
function
withPanelTypes
(
array
$types
)
{
$this
->
panelTypes
=
$types
;
return
$this
;
}
public
function
withAuthorPHIDs
(
array
$authors
)
{
$this
->
authorPHIDs
=
$authors
;
return
$this
;
}
public
function
withNameNgrams
(
$ngrams
)
{
return
$this
->
withNgramsConstraint
(
id
(
new
PhabricatorDashboardPanelNgrams
()),
$ngrams
);
}
protected
function
loadPage
()
{
return
$this
->
loadStandardPage
(
$this
->
newResultObject
());
}
public
function
newResultObject
()
{
// TODO: If we don't do this, SearchEngine explodes when trying to
// enumerate custom fields. For now, just give the panel a default panel
// type so custom fields work. In the long run, we may want to find a
// cleaner or more general approach for this.
$text_type
=
id
(
new
PhabricatorDashboardTextPanelType
())
->
getPanelTypeKey
();
return
id
(
new
PhabricatorDashboardPanel
())
->
setPanelType
(
$text_type
);
}
protected
function
buildWhereClauseParts
(
AphrontDatabaseConnection
$conn
)
{
$where
=
parent
::
buildWhereClauseParts
(
$conn
);
if
(
$this
->
ids
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'id IN (%Ld)'
,
$this
->
ids
);
}
if
(
$this
->
phids
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'phid IN (%Ls)'
,
$this
->
phids
);
}
if
(
$this
->
archived
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'isArchived = %d'
,
(
int
)
$this
->
archived
);
}
if
(
$this
->
panelTypes
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'panelType IN (%Ls)'
,
$this
->
panelTypes
);
}
if
(
$this
->
authorPHIDs
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'authorPHID IN (%Ls)'
,
$this
->
authorPHIDs
);
}
return
$where
;
}
public
function
getQueryApplicationClass
()
{
return
'PhabricatorDashboardApplication'
;
}
protected
function
getPrimaryTableAlias
()
{
return
'dashboard_panel'
;
}
}
Event Timeline
Log In to Comment