Differential D16981 Diff 41128 src/applications/release/xaction/ReleaseReleaseTemplateTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/release/xaction/ReleaseReleaseTemplateTransaction.php
- This file was added.
<?php | |||||
final class ReleaseReleaseTemplateTransaction | |||||
extends ReleaseReleaseTransactionType { | |||||
const TRANSACTIONTYPE = 'release:templatekey'; | |||||
public function generateOldValue($object) { | |||||
return $object->getReleaseTemplateKey(); | |||||
} | |||||
public function applyInternalEffects($object, $value) { | |||||
$object->setReleaseTemplateKey($value); | |||||
} | |||||
public function validateTransactions($object, array $xactions) { | |||||
foreach ($xactions as $xaction) { | |||||
$existing = $object->getReleaseTemplateKey(); | |||||
if ($existing && $existing != $xaction->getNewValue()) { | |||||
$error = $this->newError( | |||||
pht('Locked'), | |||||
pht('Cannot change template after Release is created')); | |||||
return array($error); | |||||
} | |||||
} | |||||
return array(); | |||||
} | |||||
public function getTitle() { | |||||
return pht( | |||||
'%s Did the impossible.', | |||||
$this->renderAuthor()); | |||||
} | |||||
public function getTitleForFeed() { | |||||
return pht( | |||||
'%s Did the impossible to %s.', | |||||
$this->renderAuthor(), | |||||
$this->renderObject()); | |||||
} | |||||
} |