Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diviner/editor/DivinerLiveBookEditor.php
| Show All 11 Lines | final class DivinerLiveBookEditor | ||||
| } | } | ||||
| public function getTransactionTypes() { | public function getTransactionTypes() { | ||||
| $types = parent::getTransactionTypes(); | $types = parent::getTransactionTypes(); | ||||
| $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY; | $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY; | ||||
| $types[] = PhabricatorTransactions::TYPE_EDIT_POLICY; | $types[] = PhabricatorTransactions::TYPE_EDIT_POLICY; | ||||
| $types[] = DivinerLiveBookTransaction::TYPE_ARCHIVED; | |||||
| return $types; | return $types; | ||||
| } | } | ||||
| protected function getCustomTransactionOldValue( | |||||
| PhabricatorLiskDAO $object, | |||||
| PhabricatorApplicationTransaction $xaction) { | |||||
| switch ($xaction->getTransactionType()) { | |||||
| case DivinerLiveBookTransaction::TYPE_ARCHIVED: | |||||
| return $object->getIsArchived(); | |||||
| default: | |||||
| return parent::getCustomTransactionOldValue($object, $xaction); | |||||
| } | |||||
| } | |||||
| protected function getCustomTransactionNewValue( | |||||
| PhabricatorLiskDAO $object, | |||||
| PhabricatorApplicationTransaction $xaction) { | |||||
| switch ($xaction->getTransactionType()) { | |||||
| case DivinerLiveBookTransaction::TYPE_ARCHIVED: | |||||
| return $xaction->getNewValue(); | |||||
| default: | |||||
| return parent::getCustomTransactionNewValue($object, $xaction); | |||||
| } | |||||
| } | |||||
| protected function applyCustomInternalTransaction( | |||||
| PhabricatorLiskDAO $object, | |||||
| PhabricatorApplicationTransaction $xaction) { | |||||
| switch ($xaction->getTransactionType()) { | |||||
| case DivinerLiveBookTransaction::TYPE_ARCHIVED: | |||||
| $object->setIsArchived((int)$xaction->getNewValue()); | |||||
| return; | |||||
| default: | |||||
| return parent::applyCustomInternalTransaction($object, $xaction); | |||||
| } | |||||
| } | |||||
| protected function applyCustomExternalTransaction( | |||||
| PhabricatorLiskDAO $object, | |||||
| PhabricatorApplicationTransaction $xaction) { | |||||
| $old = $xaction->getOldValue(); | |||||
| $new = $xaction->getNewValue(); | |||||
| switch ($xaction->getTransactionType()) { | |||||
| case DivinerLiveBookTransaction::TYPE_ARCHIVED: | |||||
| return; | |||||
| default: | |||||
| return parent::applyCustomExternalTransaction($object, $xaction); | |||||
| } | |||||
| } | |||||
| } | } | ||||