Page MenuHomePhorge

PhortuneAccountNameTransaction.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

PhortuneAccountNameTransaction.php

<?php
final class PhortuneAccountNameTransaction
extends PhortuneAccountTransactionType {
const TRANSACTIONTYPE = 'phortune:name';
public function generateOldValue($object) {
return $object->getName();
}
public function applyInternalEffects($object, $value) {
$object->setName($value);
}
public function getTitle() {
$old = $this->getOldValue();
$new = $this->getNewValue();
if (strlen($old) && strlen($new)) {
return pht(
'%s renamed this account from %s to %s.',
$this->renderAuthor(),
$this->renderOldValue(),
$this->renderNewValue());
} else {
return pht(
'%s created this account.',
$this->renderAuthor());
}
}
public function validateTransactions($object, array $xactions) {
$errors = array();
if ($this->isEmptyTextTransaction($object->getName(), $xactions)) {
$errors[] = $this->newRequiredError(
pht('Accounts must have a name.'));
}
$max_length = $object->getColumnMaximumByteLength('name');
foreach ($xactions as $xaction) {
$new_value = $xaction->getNewValue();
$new_length = strlen($new_value);
if ($new_length > $max_length) {
$errors[] = $this->newRequiredError(
pht('The name can be no longer than %s characters.',
new PhutilNumber($max_length)));
}
}
return $errors;
}
}

File Metadata

Mime Type
text/x-php
Expires
Thu, Jun 19, 7:34 AM (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
243280
Default Alt Text
PhortuneAccountNameTransaction.php (1 KB)

Event Timeline