Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phortune/query/PhortuneAccountQuery.php
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | final class PhortuneAccountQuery | ||||
protected function loadPage() { | protected function loadPage() { | ||||
return $this->loadStandardPage($this->newResultObject()); | return $this->loadStandardPage($this->newResultObject()); | ||||
} | } | ||||
protected function willFilterPage(array $accounts) { | protected function willFilterPage(array $accounts) { | ||||
$query = id(new PhabricatorEdgeQuery()) | $query = id(new PhabricatorEdgeQuery()) | ||||
->withSourcePHIDs(mpull($accounts, 'getPHID')) | ->withSourcePHIDs(mpull($accounts, 'getPHID')) | ||||
->withEdgeTypes(array(PhortuneAccountHasMemberEdgeType::EDGECONST)); | ->withEdgeTypes( | ||||
array( | |||||
PhortuneAccountHasMemberEdgeType::EDGECONST, | |||||
PhortuneAccountHasMerchantEdgeType::EDGECONST, | |||||
)); | |||||
$query->execute(); | $query->execute(); | ||||
foreach ($accounts as $account) { | foreach ($accounts as $account) { | ||||
$member_phids = $query->getDestinationPHIDs(array($account->getPHID())); | $member_phids = $query->getDestinationPHIDs( | ||||
array( | |||||
$account->getPHID(), | |||||
), | |||||
array( | |||||
PhortuneAccountHasMemberEdgeType::EDGECONST, | |||||
)); | |||||
$member_phids = array_reverse($member_phids); | $member_phids = array_reverse($member_phids); | ||||
$account->attachMemberPHIDs($member_phids); | $account->attachMemberPHIDs($member_phids); | ||||
$merchant_phids = $query->getDestinationPHIDs( | |||||
array( | |||||
$account->getPHID(), | |||||
), | |||||
array( | |||||
PhortuneAccountHasMerchantEdgeType::EDGECONST, | |||||
)); | |||||
$merchant_phids = array_reverse($merchant_phids); | |||||
$account->attachMerchantPHIDs($merchant_phids); | |||||
} | } | ||||
return $accounts; | return $accounts; | ||||
} | } | ||||
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { | protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { | ||||
$where = parent::buildWhereClauseParts($conn); | $where = parent::buildWhereClauseParts($conn); | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |