Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F574096
FundBackerCart.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
FundBackerCart.php
View Options
<?php
final
class
FundBackerCart
extends
PhortuneCartImplementation
{
private
$initiativePHID
;
private
$initiative
;
public
function
setInitiativePHID
(
$initiative_phid
)
{
$this
->
initiativePHID
=
$initiative_phid
;
return
$this
;
}
public
function
getInitiativePHID
()
{
return
$this
->
initiativePHID
;
}
public
function
setInitiative
(
FundInitiative
$initiative
)
{
$this
->
initiative
=
$initiative
;
return
$this
;
}
public
function
getInitiative
()
{
return
$this
->
initiative
;
}
public
function
getName
(
PhortuneCart
$cart
)
{
return
pht
(
'Fund Initiative'
);
}
public
function
willCreateCart
(
PhabricatorUser
$viewer
,
PhortuneCart
$cart
)
{
$initiative
=
$this
->
getInitiative
();
if
(!
$initiative
)
{
throw
new
PhutilInvalidStateException
(
'setInitiative'
);
}
$cart
->
setMetadataValue
(
'initiativePHID'
,
$initiative
->
getPHID
());
}
public
function
loadImplementationsForCarts
(
PhabricatorUser
$viewer
,
array
$carts
)
{
$phids
=
array
();
foreach
(
$carts
as
$cart
)
{
$phids
[]
=
$cart
->
getMetadataValue
(
'initiativePHID'
);
}
$initiatives
=
id
(
new
FundInitiativeQuery
())
->
setViewer
(
$viewer
)
->
withPHIDs
(
$phids
)
->
execute
();
$initiatives
=
mpull
(
$initiatives
,
null
,
'getPHID'
);
$objects
=
array
();
foreach
(
$carts
as
$key
=>
$cart
)
{
$initiative_phid
=
$cart
->
getMetadataValue
(
'initiativePHID'
);
$object
=
id
(
new
FundBackerCart
())
->
setInitiativePHID
(
$initiative_phid
);
$initiative
=
idx
(
$initiatives
,
$initiative_phid
);
if
(
$initiative
)
{
$object
->
setInitiative
(
$initiative
);
}
$objects
[
$key
]
=
$object
;
}
return
$objects
;
}
public
function
getCancelURI
(
PhortuneCart
$cart
)
{
return
'/'
.
$this
->
getInitiative
()->
getMonogram
();
}
public
function
getDoneURI
(
PhortuneCart
$cart
)
{
return
'/'
.
$this
->
getInitiative
()->
getMonogram
();
}
public
function
getDoneActionName
(
PhortuneCart
$cart
)
{
return
pht
(
'Return to Initiative'
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, May 13, 6:20 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
125372
Default Alt Text
FundBackerCart.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment