Differential D20414 Diff 48757 src/applications/dashboard/xaction/panel/PhabricatorDashboardQueryPanelApplicationTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/dashboard/xaction/panel/PhabricatorDashboardQueryPanelApplicationTransaction.php
| <?php | <?php | ||||
| final class PhabricatorDashboardQueryPanelApplicationTransaction | final class PhabricatorDashboardQueryPanelApplicationTransaction | ||||
| extends PhabricatorDashboardPanelPropertyTransaction { | extends PhabricatorDashboardPanelPropertyTransaction { | ||||
| const TRANSACTIONTYPE = 'query.application'; | const TRANSACTIONTYPE = 'query.application'; | ||||
| protected function getPropertyKey() { | protected function getPropertyKey() { | ||||
| return 'class'; | return 'class'; | ||||
| } | } | ||||
| public function validateTransactions($object, array $xactions) { | |||||
| $errors = array(); | |||||
| $engines = PhabricatorApplicationSearchEngine::getAllEngines(); | |||||
| $old_value = $object->getProperty($this->getPropertyKey()); | |||||
| foreach ($xactions as $xaction) { | |||||
| $new_value = $xaction->getNewValue(); | |||||
| if ($new_value === $old_value) { | |||||
| continue; | |||||
| } | |||||
| if (!isset($engines[$new_value])) { | |||||
| $errors[] = $this->newInvalidError( | |||||
| pht( | |||||
| 'Application search engine class "%s" is unknown. Query panels '. | |||||
| 'must use a known search engine class.', | |||||
| $new_value), | |||||
| $xaction); | |||||
| continue; | |||||
| } | |||||
| } | |||||
| return $errors; | |||||
| } | |||||
| } | } | ||||