Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/almanac/xaction/AlmanacInterfaceDestroyTransaction.php
12256 views
1
<?php
2
3
final class AlmanacInterfaceDestroyTransaction
4
extends AlmanacInterfaceTransactionType {
5
6
const TRANSACTIONTYPE = 'almanac:interface:destroy';
7
8
public function generateOldValue($object) {
9
return false;
10
}
11
12
public function applyExternalEffects($object, $value) {
13
id(new PhabricatorDestructionEngine())
14
->destroyObject($object);
15
}
16
17
public function validateTransactions($object, array $xactions) {
18
$errors = array();
19
20
if ($xactions) {
21
if ($object->loadIsInUse()) {
22
$errors[] = $this->newInvalidError(
23
pht(
24
'You can not delete this interface because it is currently in '.
25
'use. One or more services are bound to it.'));
26
}
27
}
28
29
return $errors;
30
}
31
32
}
33
34