Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/nuance/xaction/NuanceSourceDefaultQueueTransaction.php
12256 views
1
<?php
2
3
final class NuanceSourceDefaultQueueTransaction
4
extends NuanceSourceTransactionType {
5
6
const TRANSACTIONTYPE = 'source.queue.default';
7
8
public function generateOldValue($object) {
9
return $object->getDefaultQueuePHID();
10
}
11
12
public function applyInternalEffects($object, $value) {
13
$object->setDefaultQueuePHID($value);
14
}
15
16
public function getTitle() {
17
return pht(
18
'%s changed the default queue for this source from %s to %s.',
19
$this->renderAuthor(),
20
$this->renderOldHandle(),
21
$this->renderNewHandle());
22
}
23
24
public function validateTransactions($object, array $xactions) {
25
$errors = array();
26
27
if (!$object->getDefaultQueuePHID() && !$xactions) {
28
$errors[] = $this->newRequiredError(
29
pht('Sources must have a default queue.'));
30
}
31
32
foreach ($xactions as $xaction) {
33
if (!$xaction->getNewValue()) {
34
$errors[] = $this->newRequiredError(
35
pht('Sources must have a default queue.'));
36
}
37
}
38
39
return $errors;
40
}
41
42
}
43
44