Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91660312
PonderAnswerQuery.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
Wed, Nov 13, 05:05
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Nov 15, 05:05 (2 d)
Engine
blob
Format
Raw Data
Handle
22302732
Attached To
rPH Phabricator
PonderAnswerQuery.php
View Options
<?php
final
class
PonderAnswerQuery
extends
PhabricatorCursorPagedPolicyAwareQuery
{
private
$ids
;
private
$phids
;
private
$authorPHIDs
;
private
$questionIDs
;
public
function
withIDs
(
array
$ids
)
{
$this
->
ids
=
$ids
;
return
$this
;
}
public
function
withPHIDs
(
array
$phids
)
{
$this
->
phids
=
$phids
;
return
$this
;
}
public
function
withAuthorPHIDs
(
array
$phids
)
{
$this
->
authorPHIDs
=
$phids
;
return
$this
;
}
public
function
withQuestionIDs
(
array
$ids
)
{
$this
->
questionIDs
=
$ids
;
return
$this
;
}
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
->
authorPHIDs
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'authorPHID IN (%Ls)'
,
$this
->
authorPHIDs
);
}
return
$where
;
}
public
function
newResultObject
()
{
return
new
PonderAnswer
();
}
protected
function
loadPage
()
{
return
$this
->
loadStandardPage
(
new
PonderAnswer
());
}
protected
function
willFilterPage
(
array
$answers
)
{
$questions
=
id
(
new
PonderQuestionQuery
())
->
setViewer
(
$this
->
getViewer
())
->
withIDs
(
mpull
(
$answers
,
'getQuestionID'
))
->
execute
();
foreach
(
$answers
as
$key
=>
$answer
)
{
$question
=
idx
(
$questions
,
$answer
->
getQuestionID
());
if
(!
$question
)
{
unset
(
$answers
[
$key
]);
continue
;
}
$answer
->
attachQuestion
(
$question
);
}
return
$answers
;
}
public
function
getQueryApplicationClass
()
{
return
'PhabricatorPonderApplication'
;
}
}
Event Timeline
Log In to Comment