Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93932924
PhabricatorPackagesPublisherNameTransaction.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
Mon, Dec 2, 15:01
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Dec 4, 15:01 (2 d)
Engine
blob
Format
Raw Data
Handle
22652681
Attached To
rPH Phabricator
PhabricatorPackagesPublisherNameTransaction.php
View Options
<?php
final
class
PhabricatorPackagesPublisherNameTransaction
extends
PhabricatorPackagesPublisherTransactionType
{
const
TRANSACTIONTYPE
=
'packages.publisher.name'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getName
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setName
(
$value
);
}
public
function
getTitle
()
{
return
pht
(
'%s changed the name of this publisher from %s to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderOldValue
(),
$this
->
renderNewValue
());
}
public
function
getTitleForFeed
()
{
return
pht
(
'%s updated the name for %s from %s to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
(),
$this
->
renderOldValue
(),
$this
->
renderNewValue
());
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
if
(
$this
->
isEmptyTextTransaction
(
$object
->
getName
(),
$xactions
))
{
$errors
[]
=
$this
->
newRequiredError
(
pht
(
'Publishers must have a name.'
));
}
foreach
(
$xactions
as
$xaction
)
{
$value
=
$xaction
->
getNewValue
();
try
{
PhabricatorPackagesPublisher
::
assertValidPublisherName
(
$value
);
}
catch
(
Exception
$ex
)
{
$errors
[]
=
$this
->
newInvalidError
(
$ex
->
getMessage
(),
$xaction
);
}
}
return
$errors
;
}
}
Event Timeline
Log In to Comment