Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2894400
PhabricatorProjectColumnTransactionEditor.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
3 KB
Referenced Files
None
Subscribers
None
PhabricatorProjectColumnTransactionEditor.php
View Options
<?php
final
class
PhabricatorProjectColumnTransactionEditor
extends
PhabricatorApplicationTransactionEditor
{
public
function
getTransactionTypes
(
)
{
$types
=
parent
::
getTransactionTypes
(
)
;
$types
[
]
=
PhabricatorProjectColumnTransaction
::
TYPE_NAME
;
$types
[
]
=
PhabricatorProjectColumnTransaction
::
TYPE_STATUS
;
return
$types
;
}
protected
function
getCustomTransactionOldValue
(
PhabricatorLiskDAO
$object
,
PhabricatorApplicationTransaction
$xaction
)
{
switch
(
$xaction
->
getTransactionType
(
)
)
{
case
PhabricatorProjectColumnTransaction
::
TYPE_NAME
:
return
$object
->
getName
(
)
;
case
PhabricatorProjectColumnTransaction
::
TYPE_STATUS
:
return
$object
->
getStatus
(
)
;
}
return
parent
::
getCustomTransactionOldValue
(
$object
,
$xaction
)
;
}
protected
function
getCustomTransactionNewValue
(
PhabricatorLiskDAO
$object
,
PhabricatorApplicationTransaction
$xaction
)
{
switch
(
$xaction
->
getTransactionType
(
)
)
{
case
PhabricatorProjectColumnTransaction
::
TYPE_NAME
:
case
PhabricatorProjectColumnTransaction
::
TYPE_STATUS
:
return
$xaction
->
getNewValue
(
)
;
}
return
parent
::
getCustomTransactionNewValue
(
$object
,
$xaction
)
;
}
protected
function
applyCustomInternalTransaction
(
PhabricatorLiskDAO
$object
,
PhabricatorApplicationTransaction
$xaction
)
{
switch
(
$xaction
->
getTransactionType
(
)
)
{
case
PhabricatorProjectColumnTransaction
::
TYPE_NAME
:
$object
->
setName
(
$xaction
->
getNewValue
(
)
)
;
return
;
case
PhabricatorProjectColumnTransaction
::
TYPE_STATUS
:
$object
->
setStatus
(
$xaction
->
getNewValue
(
)
)
;
return
;
}
return
parent
::
applyCustomInternalTransaction
(
$object
,
$xaction
)
;
}
protected
function
applyCustomExternalTransaction
(
PhabricatorLiskDAO
$object
,
PhabricatorApplicationTransaction
$xaction
)
{
switch
(
$xaction
->
getTransactionType
(
)
)
{
case
PhabricatorProjectColumnTransaction
::
TYPE_NAME
:
case
PhabricatorProjectColumnTransaction
::
TYPE_STATUS
:
return
;
}
return
parent
::
applyCustomExternalTransaction
(
$object
,
$xaction
)
;
}
protected
function
validateTransaction
(
PhabricatorLiskDAO
$object
,
$type
,
array
$xactions
)
{
$errors
=
parent
::
validateTransaction
(
$object
,
$type
,
$xactions
)
;
switch
(
$type
)
{
case
PhabricatorProjectColumnTransaction
::
TYPE_NAME
:
$missing
=
$this
->
validateIsEmptyTextField
(
$object
->
getName
(
)
,
$xactions
)
;
// The default "Backlog" column is allowed to be unnamed, which
// means we use the default name.
if
(
$missing
&&
!
$object
->
isDefaultColumn
(
)
)
{
$error
=
new
PhabricatorApplicationTransactionValidationError
(
$type
,
pht
(
'Required'
)
,
pht
(
'Column name is required.'
)
,
nonempty
(
last
(
$xactions
)
,
null
)
)
;
$error
->
setIsMissingFieldError
(
true
)
;
$errors
[
]
=
$error
;
}
break
;
}
return
$errors
;
}
protected
function
requireCapabilities
(
PhabricatorLiskDAO
$object
,
PhabricatorApplicationTransaction
$xaction
)
{
switch
(
$xaction
->
getTransactionType
(
)
)
{
case
PhabricatorProjectColumnTransaction
::
TYPE_NAME
:
case
PhabricatorProjectColumnTransaction
::
TYPE_STATUS
:
PhabricatorPolicyFilter
::
requireCapability
(
$this
->
requireActor
(
)
,
$object
,
PhabricatorPolicyCapability
::
CAN_EDIT
)
;
return
;
}
return
parent
::
requireCapabilities
(
$object
,
$xaction
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 19:49 (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1128153
Default Alt Text
PhabricatorProjectColumnTransactionEditor.php (3 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment