Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F109851915
DifferentialDraft.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, Apr 23, 15:52
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Apr 25, 15:52 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
25762887
Attached To
rPH Phabricator
DifferentialDraft.php
View Options
<?php
final
class
DifferentialDraft
extends
DifferentialDAO
{
protected
$objectPHID
;
protected
$authorPHID
;
protected
$draftKey
;
public
static
function
markHasDraft
(
$author_phid
,
$object_phid
,
$draft_key
)
{
try
{
id
(
new
DifferentialDraft
())
->
setObjectPHID
(
$object_phid
)
->
setAuthorPHID
(
$author_phid
)
->
setDraftKey
(
$draft_key
)
->
save
();
}
catch
(
AphrontDuplicateKeyQueryException
$ex
)
{
// no worries
}
}
public
static
function
deleteHasDraft
(
$author_phid
,
$object_phid
,
$draft_key
)
{
$draft
=
id
(
new
DifferentialDraft
())->
loadOneWhere
(
'objectPHID = %s AND authorPHID = %s AND draftKey = %s'
,
$object_phid
,
$author_phid
,
$draft_key
);
if
(
$draft
)
{
$draft
->
delete
();
}
}
public
static
function
deleteAllDrafts
(
$author_phid
,
$object_phid
)
{
$drafts
=
id
(
new
DifferentialDraft
())->
loadAllWhere
(
'objectPHID = %s AND authorPHID = %s'
,
$object_phid
,
$author_phid
);
foreach
(
$drafts
as
$draft
)
{
$draft
->
delete
();
}
}
}
Event Timeline
Log In to Comment