Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1093989
PhortuneChargeQuery.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
PhortuneChargeQuery.php
View Options
<?php
final
class
PhortuneChargeQuery
extends
PhabricatorCursorPagedPolicyAwareQuery
{
private
$ids
;
private
$phids
;
private
$accountPHIDs
;
public
function
withIDs
(
array
$ids
)
{
$this
->
ids
=
$ids
;
return
$this
;
}
public
function
withPHIDs
(
array
$phids
)
{
$this
->
phids
=
$phids
;
return
$this
;
}
public
function
withAccountPHIDs
(
array
$account_phids
)
{
$this
->
accountPHIDs
=
$account_phids
;
return
$this
;
}
protected
function
loadPage
()
{
$table
=
new
PhortuneCharge
();
$conn
=
$table
->
establishConnection
(
'r'
);
$rows
=
queryfx_all
(
$conn
,
'SELECT charge.* FROM %T charge %Q %Q %Q'
,
$table
->
getTableName
(),
$this
->
buildWhereClause
(
$conn
),
$this
->
buildOrderClause
(
$conn
),
$this
->
buildLimitClause
(
$conn
));
return
$table
->
loadAllFromArray
(
$rows
);
}
protected
function
willFilterPage
(
array
$charges
)
{
$accounts
=
id
(
new
PhortuneAccountQuery
())
->
setViewer
(
$this
->
getViewer
())
->
setParentQuery
(
$this
)
->
withPHIDs
(
mpull
(
$charges
,
'getAccountPHID'
))
->
execute
();
$accounts
=
mpull
(
$accounts
,
null
,
'getPHID'
);
foreach
(
$charges
as
$key
=>
$charge
)
{
$account
=
idx
(
$accounts
,
$charge
->
getAccountPHID
());
if
(!
$account
)
{
unset
(
$charges
[
$key
]);
continue
;
}
$charge
->
attachAccount
(
$account
);
}
return
$charges
;
}
private
function
buildWhereClause
(
AphrontDatabaseConnection
$conn
)
{
$where
=
array
();
$where
[]
=
$this
->
buildPagingClause
(
$conn
);
if
(
$this
->
ids
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'charge.id IN (%Ld)'
,
$this
->
ids
);
}
if
(
$this
->
phids
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'charge.phid IN (%Ls)'
,
$this
->
phids
);
}
if
(
$this
->
accountPHIDs
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'charge.accountPHID IN (%Ls)'
,
$this
->
accountPHIDs
);
}
return
$this
->
formatWhereClause
(
$where
);
}
public
function
getQueryApplicationClass
()
{
return
'PhabricatorApplicationPhortune'
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Jun 30, 8:17 AM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
270340
Default Alt Text
PhortuneChargeQuery.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment