Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F680028
DifferentialDraft.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
DifferentialDraft.php
View Options
<?php
final
class
DifferentialDraft
extends
DifferentialDAO
{
protected
$objectPHID
;
protected
$authorPHID
;
protected
$draftKey
;
protected
function
getConfiguration
()
{
return
array
(
self
::
CONFIG_COLUMN_SCHEMA
=>
array
(
'draftKey'
=>
'text64'
,
),
self
::
CONFIG_KEY_SCHEMA
=>
array
(
'key_unique'
=>
array
(
'columns'
=>
array
(
'objectPHID'
,
'authorPHID'
,
'draftKey'
),
'unique'
=>
true
,
),
),
)
+
parent
::
getConfiguration
();
}
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
();
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, May 27, 8:57 AM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
166681
Default Alt Text
DifferentialDraft.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment