3 final class NuanceSourceNameTransaction
4 extends NuanceSourceTransactionType
{
6 const TRANSACTIONTYPE
= 'source.name';
8 public function generateOldValue($object) {
9 return $object->getName();
12 public function applyInternalEffects($object, $value) {
13 $object->setName($value);
16 public function getTitle() {
18 '%s renamed this source from %s to %s.',
19 $this->renderAuthor(),
20 $this->renderOldValue(),
21 $this->renderNewValue());
24 public function validateTransactions($object, array $xactions) {
27 if ($this->isEmptyTextTransaction($object->getName(), $xactions)) {
28 $errors[] = $this->newRequiredError(
29 pht('Sources must have a name.'));
32 $max_length = $object->getColumnMaximumByteLength('name');
33 foreach ($xactions as $xaction) {
34 $new_value = $xaction->getNewValue();
35 $new_length = strlen($new_value);
36 if ($new_length > $max_length) {
37 $errors[] = $this->newInvalidError(
39 'Source names must not be longer than %s character(s).',
40 new PhutilNumber($max_length)));