3 final class PhabricatorAuthContactNumberPrimaryTransaction
4 extends PhabricatorAuthContactNumberTransactionType
{
6 const TRANSACTIONTYPE
= 'primary';
8 public function generateOldValue($object) {
9 return (bool)$object->getIsPrimary();
12 public function applyInternalEffects($object, $value) {
13 $object->setIsPrimary((int)$value);
16 public function getTitle() {
18 '%s made this the primary contact number.',
19 $this->renderAuthor());
22 public function validateTransactions($object, array $xactions) {
25 foreach ($xactions as $xaction) {
26 $new_value = $xaction->getNewValue();
29 $errors[] = $this->newInvalidError(
31 'To choose a different primary contact number, make that '.
32 'number primary (instead of trying to demote this one).'),
37 if ($object->isDisabled()) {
38 $errors[] = $this->newInvalidError(
40 'You can not make a disabled number a primary contact number.'),
45 $mfa_error = $this->newContactNumberMFAError($object, $xaction);
47 $errors[] = $mfa_error;