3 final class PhameBlogParentSiteTransaction
4 extends PhameBlogTransactionType
{
6 const TRANSACTIONTYPE
= 'phame.blog.parent.site';
8 public function generateOldValue($object) {
9 return $object->getParentSite();
12 public function applyInternalEffects($object, $value) {
13 $object->setParentSite($value);
16 public function getTitle() {
17 $old = $this->getOldValue();
20 '%s set this blog\'s parent site to %s.',
21 $this->renderAuthor(),
22 $this->renderNewValue());
25 '%s updated the blog\'s parent site from %s to %s.',
26 $this->renderAuthor(),
27 $this->renderOldValue(),
28 $this->renderNewValue());
32 public function getTitleForFeed() {
33 $old = $this->getOldValue();
36 '%s set %s blog\'s parent site to %s.',
37 $this->renderAuthor(),
38 $this->renderObject(),
39 $this->renderNewValue());
42 '%s updated %s blog\'s parent site from %s to %s.',
43 $this->renderAuthor(),
44 $this->renderObject(),
45 $this->renderOldValue(),
46 $this->renderNewValue());
50 public function validateTransactions($object, array $xactions) {
53 $max_length = $object->getColumnMaximumByteLength('parentSite');
54 foreach ($xactions as $xaction) {
55 $new_value = $xaction->getNewValue();
56 $new_length = strlen($new_value);
57 if ($new_length > $max_length) {
58 $errors[] = $this->newInvalidError(
59 pht('The parent site can be no longer than %s characters.',
60 new PhutilNumber($max_length)));