Changeset View
Changeset View
Standalone View
Standalone View
src/applications/nuance/storage/NuanceSource.php
| <?php | <?php | ||||
| final class NuanceSource extends NuanceDAO | final class NuanceSource extends NuanceDAO | ||||
| implements | implements | ||||
| PhabricatorApplicationTransactionInterface, | PhabricatorApplicationTransactionInterface, | ||||
| PhabricatorPolicyInterface { | PhabricatorPolicyInterface { | ||||
| protected $name; | protected $name; | ||||
| protected $type; | protected $type; | ||||
| protected $data; | protected $data; | ||||
| protected $mailKey; | protected $mailKey; | ||||
| protected $viewPolicy; | protected $viewPolicy; | ||||
| protected $editPolicy; | protected $editPolicy; | ||||
| private $definition; | |||||
| protected function getConfiguration() { | protected function getConfiguration() { | ||||
| return array( | return array( | ||||
| self::CONFIG_AUX_PHID => true, | self::CONFIG_AUX_PHID => true, | ||||
| self::CONFIG_SERIALIZATION => array( | self::CONFIG_SERIALIZATION => array( | ||||
| 'data' => self::SERIALIZATION_JSON, | 'data' => self::SERIALIZATION_JSON, | ||||
| ), | ), | ||||
| self::CONFIG_COLUMN_SCHEMA => array( | self::CONFIG_COLUMN_SCHEMA => array( | ||||
| 'name' => 'text255?', | 'name' => 'text255?', | ||||
| Show All 34 Lines | public static function initializeNewSource(PhabricatorUser $actor) { | ||||
| $edit_policy = $app->getPolicy( | $edit_policy = $app->getPolicy( | ||||
| NuanceSourceDefaultEditCapability::CAPABILITY); | NuanceSourceDefaultEditCapability::CAPABILITY); | ||||
| return id(new NuanceSource()) | return id(new NuanceSource()) | ||||
| ->setViewPolicy($view_policy) | ->setViewPolicy($view_policy) | ||||
| ->setEditPolicy($edit_policy); | ->setEditPolicy($edit_policy); | ||||
| } | } | ||||
| public function getDefinition() { | |||||
| if ($this->definition === null) { | |||||
| $definitions = NuanceSourceDefinition::getAllDefinitions(); | |||||
| if (isset($definitions[$this->getType()])) { | |||||
| $definition = clone $definitions[$this->getType()]; | |||||
| $definition->setSourceObject($this); | |||||
| $this->definition = $definition; | |||||
| } | |||||
| } | |||||
| return $this->definition; | |||||
| } | |||||
| public function requireDefinition() { | |||||
| $definition = $this->getDefinition(); | |||||
| if (!$definition) { | |||||
| throw new Exception( | |||||
| pht( | |||||
| 'Unable to load source definition implementation for source '. | |||||
| 'type "%s".', | |||||
| $this->getType())); | |||||
| } | |||||
| return $definition; | |||||
| } | |||||
| /* -( PhabricatorApplicationTransactionInterface )------------------------- */ | /* -( PhabricatorApplicationTransactionInterface )------------------------- */ | ||||
| public function getApplicationTransactionEditor() { | public function getApplicationTransactionEditor() { | ||||
| return new NuanceSourceEditor(); | return new NuanceSourceEditor(); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines | |||||