3 final class PhameBlogSubtitleTransaction
4 extends PhameBlogTransactionType
{
6 const TRANSACTIONTYPE
= 'phame.blog.subtitle';
8 public function generateOldValue($object) {
9 return $object->getSubtitle();
12 public function applyInternalEffects($object, $value) {
13 $object->setSubtitle($value);
16 public function getTitle() {
17 $old = $this->getOldValue();
20 '%s set this blog\'s subtitle to "%s".',
21 $this->renderAuthor(),
22 $this->renderNewValue());
25 '%s updated the blog\'s subtitle to "%s".',
26 $this->renderAuthor(),
27 $this->renderNewValue());
31 public function getTitleForFeed() {
32 $old = $this->getOldValue();
35 '%s set the subtitle for %s.',
36 $this->renderAuthor(),
37 $this->renderObject());
40 '%s updated the subtitle for %s.',
41 $this->renderAuthor(),
42 $this->renderObject());
46 public function validateTransactions($object, array $xactions) {
49 $max_length = $object->getColumnMaximumByteLength('subtitle');
50 foreach ($xactions as $xaction) {
51 $new_value = $xaction->getNewValue();
52 $new_length = strlen($new_value);
53 if ($new_length > $max_length) {
54 $errors[] = $this->newInvalidError(
55 pht('The subtitle can be no longer than %s characters.',
56 new PhutilNumber($max_length)));