Changeset View
Changeset View
Standalone View
Standalone View
src/applications/nuance/source/NuanceSourceDefinition.php
| Show First 20 Lines • Show All 143 Lines • ▼ Show 20 Lines | public function renderView() { | ||||
| return null; | return null; | ||||
| } | } | ||||
| public function renderListView() { | public function renderListView() { | ||||
| return null; | return null; | ||||
| } | } | ||||
| protected function newItemFromProperties( | protected function newItemFromProperties( | ||||
| $item_type, | |||||
| $author_phid, | |||||
| array $properties, | array $properties, | ||||
| PhabricatorContentSource $content_source) { | PhabricatorContentSource $content_source) { | ||||
| // TODO: Should we have a tighter actor/viewer model? Requestors will | // TODO: Should we have a tighter actor/viewer model? Requestors will | ||||
| // often have no real user associated with them... | // often have no real user associated with them... | ||||
| $actor = PhabricatorUser::getOmnipotentUser(); | $actor = PhabricatorUser::getOmnipotentUser(); | ||||
| $source = $this->getSource(); | $source = $this->getSource(); | ||||
| $item = NuanceItem::initializeNewItem(); | $item = NuanceItem::initializeNewItem($item_type); | ||||
| $xactions = array(); | $xactions = array(); | ||||
| $xactions[] = id(new NuanceItemTransaction()) | $xactions[] = id(new NuanceItemTransaction()) | ||||
| ->setTransactionType(NuanceItemSourceTransaction::TRANSACTIONTYPE) | ->setTransactionType(NuanceItemSourceTransaction::TRANSACTIONTYPE) | ||||
| ->setNewValue($source->getPHID()); | ->setNewValue($source->getPHID()); | ||||
| // TODO: Eventually, apply real routing rules. For now, just put everything | // TODO: Eventually, apply real routing rules. For now, just put everything | ||||
| // in the default queue for the source. | // in the default queue for the source. | ||||
| $xactions[] = id(new NuanceItemTransaction()) | $xactions[] = id(new NuanceItemTransaction()) | ||||
| ->setTransactionType(NuanceItemQueueTransaction::TRANSACTIONTYPE) | ->setTransactionType(NuanceItemQueueTransaction::TRANSACTIONTYPE) | ||||
| ->setNewValue($source->getDefaultQueuePHID()); | ->setNewValue($source->getDefaultQueuePHID()); | ||||
| // TODO: Maybe this should all be modular transactions now? | // TODO: Maybe this should all be modular transactions now? | ||||
| foreach ($properties as $key => $property) { | foreach ($properties as $key => $property) { | ||||
| $xactions[] = id(new NuanceItemTransaction()) | $xactions[] = id(new NuanceItemTransaction()) | ||||
| ->setTransactionType(NuanceItemPropertyTransaction::TRANSACTIONTYPE) | ->setTransactionType(NuanceItemPropertyTransaction::TRANSACTIONTYPE) | ||||
| ->setMetadataValue(NuanceItemTransaction::PROPERTY_KEY, $key) | ->setMetadataValue(NuanceItemTransaction::PROPERTY_KEY, $key) | ||||
| ->setNewValue($property); | ->setNewValue($property); | ||||
| } | } | ||||
| $editor = id(new NuanceItemEditor()) | $editor = id(new NuanceItemEditor()) | ||||
| ->setActor($actor) | ->setActor($actor) | ||||
| ->setActingAsPHID($author_phid) | |||||
| ->setContentSource($content_source); | ->setContentSource($content_source); | ||||
| $editor->applyTransactions($item, $xactions); | $editor->applyTransactions($item, $xactions); | ||||
| return $item; | return $item; | ||||
| } | } | ||||
| public function renderItemEditProperties( | public function renderItemEditProperties( | ||||
| Show All 20 Lines | |||||