## 사용법 ### Default config 조회 php $config = $configHandler->getDefault(); ### Config 조회 php $config = $configHandler->get('instance-id'); ### Config 목록 조회 php $configs = $configHandler->gets(); ### Config 생성 * 인스턴스 생성할 때 Document Config 추가가 php $params = []; $config = $configHandler->makeEntity('instance-id', $params); $config = $configHandler->add($config); ### Config 수정 php $config = $config; $configHandler->put($config); ### Config 삭제 php $config = $config; $configHandler->remove($config);
Author: XE Team (developers) (developers@xpressengine.com)
Ejemplo n.º 1
0
 /**
  * drop instance
  *
  * @param ConfigEntity $config 현재 설정 되어 있는 config
  * @return void
  */
 public function remove(ConfigEntity $config)
 {
     $this->connection->beginTransaction();
     $this->configHandler->remove($config);
     $this->dropDivisionTable($config);
     $this->connection->commit();
 }
Ejemplo n.º 2
0
 /**
  * drop instance
  *
  * @param ConfigEntity $config     현재 설정 되어 있는 config
  * @param int          $fetchCount fetch count
  * @return void
  */
 public function remove(ConfigEntity $config, $fetchCount = 10)
 {
     $this->repo->connection()->beginTransaction();
     $this->repo->dropDivisionTable($config);
     $this->configHandler->remove($config);
     // division table 은 drop 했으므로 처리하지 않는다.
     $config->set('division', false);
     while ($docs = $this->repo->fetch(['instanceId' => $config->get('instanceId')], null, $config, $fetchCount)) {
         foreach ($docs as $doc) {
             $this->repo->delete(new DocumentEntity($doc), $config);
         }
     }
     $this->repo->connection()->commit();
 }
 /**
  * test put exception
  *
  * @expectedException \Xpressengine\Document\Exceptions\ConfigException
  * @return void
  */
 public function testPutChangedInstanceIdException()
 {
     $instanceConfig1 = m::mock('Xpressengine\\Config\\ConfigEntity');
     $instanceConfig1->shouldReceive('get')->with('instanceId')->andReturn('instance1');
     $instanceConfig1->shouldReceive('diff')->andReturn(['instance1' => 'changed']);
     $configManager = m::mock('Xpressengine\\Config\\ConfigManager');
     $configManager->shouldReceive('get')->andReturn(null);
     /** @var \Xpressengine\Config\ConfigManager $configManager */
     $configHandler = new ConfigHandler($configManager);
     /** @var \Xpressengine\Config\ConfigEntity $instanceConfig1 */
     $configHandler->put($instanceConfig1);
 }
Ejemplo n.º 4
0
 /**
  * get document config
  *
  * @param string $boardId board id
  * @return ConfigEntity
  */
 public function getDocument($boardId)
 {
     return $this->document->get($boardId);
 }
Ejemplo n.º 5
0
 /**
  * get document config
  *
  * @param string $instanceId instance id
  * @return ConfigEntity
  */
 public function getConfig($instanceId)
 {
     return $this->configHandler->getOrDefault($instanceId);
 }
Ejemplo n.º 6
0
 /**
  * get revision list
  *
  * @param string $id document id
  * @return array
  */
 public function getRevisions($id)
 {
     $origin = $this->repo->findById($id);
     $config = $this->configHandler->get($origin['instanceId']);
     $docs = $this->repo->getsRevision($id, $config);
     foreach ($docs as $key => $row) {
         $doc = new DocumentEntity($row);
         $docs[$key] = $doc;
     }
     return $docs;
 }