1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-03 20:22:46 +01:00
phorge-phorge/src/applications/nuance/xaction/NuanceSourceDefaultQueueTransaction.php
epriestley 3a0a086a09 Convert Nuance sources to modular transactions
Summary: Ref T12738. Update sources to modular transactions.

Test Plan: Created and edited a source.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12738

Differential Revision: https://secure.phabricator.com/D17994
2017-05-22 11:18:23 -07:00

42 lines
1 KiB
PHP

<?php
final class NuanceSourceDefaultQueueTransaction
extends NuanceSourceTransactionType {
const TRANSACTIONTYPE = 'source.queue.default';
public function generateOldValue($object) {
return $object->getDefaultQueuePHID();
}
public function applyInternalEffects($object, $value) {
$object->setDefaultQueuePHID($value);
}
public function getTitle() {
return pht(
'%s changed the default queue for this source from %s to %s.',
$this->renderAuthor(),
$this->renderOldHandle(),
$this->renderNewHandle());
}
public function validateTransactions($object, array $xactions) {
$errors = array();
if (!$object->getDefaultQueuePHID() && !$xactions) {
$errors[] = $this->newRequiredError(
pht('Sources must have a default queue.'));
}
foreach ($xactions as $xaction) {
if (!$xaction->getNewValue()) {
$errors[] = $this->newRequiredError(
pht('Sources must have a default queue.'));
}
}
return $errors;
}
}