Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/editengine/PhabricatorEditEngine.php
| Show First 20 Lines • Show All 652 Lines • ▼ Show 20 Lines | private function buildEditResponse($object) { | ||||
| $request = $controller->getRequest(); | $request = $controller->getRequest(); | ||||
| $fields = $this->buildEditFields($object); | $fields = $this->buildEditFields($object); | ||||
| $template = $object->getApplicationTransactionTemplate(); | $template = $object->getApplicationTransactionTemplate(); | ||||
| $validation_exception = null; | $validation_exception = null; | ||||
| if ($request->isFormPost()) { | if ($request->isFormPost()) { | ||||
| foreach ($fields as $field) { | foreach ($fields as $field) { | ||||
| if ($field->getIsLocked() || $field->getIsHidden()) { | |||||
| continue; | |||||
| } | |||||
| $field->readValueFromSubmit($request); | $field->readValueFromSubmit($request); | ||||
| } | } | ||||
| $xactions = array(); | $xactions = array(); | ||||
| foreach ($fields as $field) { | foreach ($fields as $field) { | ||||
| $xactions[] = $field->generateTransaction(clone $template); | $xaction = $field->generateTransaction(clone $template); | ||||
| if (!$xaction) { | |||||
| continue; | |||||
| } | |||||
| $xactions[] = $xaction; | |||||
| } | } | ||||
| $editor = $object->getApplicationTransactionEditor() | $editor = $object->getApplicationTransactionEditor() | ||||
| ->setActor($viewer) | ->setActor($viewer) | ||||
| ->setContentSourceFromRequest($request) | ->setContentSourceFromRequest($request) | ||||
| ->setContinueOnNoEffect(true); | ->setContinueOnNoEffect(true); | ||||
| try { | try { | ||||
| $editor->applyTransactions($object, $xactions); | $editor->applyTransactions($object, $xactions); | ||||
| return id(new AphrontRedirectResponse()) | return id(new AphrontRedirectResponse()) | ||||
| ->setURI($this->getObjectViewURI($object)); | ->setURI($this->getObjectViewURI($object)); | ||||
| } catch (PhabricatorApplicationTransactionValidationException $ex) { | } catch (PhabricatorApplicationTransactionValidationException $ex) { | ||||
| $validation_exception = $ex; | $validation_exception = $ex; | ||||
| } | } | ||||
| } else { | } else { | ||||
| if ($this->getIsCreate()) { | if ($this->getIsCreate()) { | ||||
| foreach ($fields as $field) { | foreach ($fields as $field) { | ||||
| if ($field->getIsLocked() || $field->getIsHidden()) { | |||||
| continue; | |||||
| } | |||||
| $field->readValueFromRequest($request); | $field->readValueFromRequest($request); | ||||
| } | } | ||||
| } else { | } else { | ||||
| foreach ($fields as $field) { | foreach ($fields as $field) { | ||||
| $field->readValueFromObject($object); | $field->readValueFromObject($object); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 351 Lines • Show Last 20 Lines | |||||