/** * dropPage * * @param string $pageId page instance id * * @return void * @throws \Exception */ public function dropPage($pageId) { XeDB::beginTransaction(); try { $documentConfig = $this->document->getConfigHandler()->get($pageId); $instanceManager = $this->document->getInstanceManager(); $instanceManager->remove($documentConfig); $this->removePageConfig($pageId); } catch (\Exception $e) { XeDB::rollback(); throw $e; } XeDB::commit(); }
/** * 게시판 설정 변경 * * @param array $params parameters * @return ConfigEntity */ public function updateConfig(array $params) { if (empty($params['boardId']) === true) { throw new RequiredValueException(); } $config = $this->configHandler->get($params['boardId']); if ($config === null) { throw new InvalidConfigException(); } $params = array_merge($config->getPureAll(), $params); $this->conn->beginTransaction(); $config = $this->configHandler->put($params); $configHandler = $this->document->getConfigHandler(); $documentConfig = $configHandler->makeEntity($params['boardId'], $params); $this->document->getInstanceManager()->put($documentConfig); $this->conn->commit(); return $config; }
/** * 게시판 설정 변경 * * @param array $params parameters * @return ConfigEntity */ public function updateConfig(array $params) { if (empty($params['boardId']) === true) { throw new RequiredValueException(['key' => 'boardId']); } $config = $this->configHandler->get($params['boardId']); if ($config === null) { throw new InvalidConfigException(); } $configHandler = $this->document->getConfigHandler(); $documentConfig = $configHandler->get($params['boardId']); foreach ($params as $key => $value) { $config->set($key, $value); $documentConfig->set($key, $value); } $this->conn->beginTransaction(); $config = $this->configHandler->put($config->getPureAll()); $this->document->getInstanceManager()->put($documentConfig); $this->conn->commit(); return $config; }
/** * test get property * * @return void */ public function testGetProperty() { $conn = $this->conn; $repo = $this->repo; $configHandler = $this->configHandler; $instanceManager = $this->instanceManager; $request = $this->request; $handler = new DocumentHandler($conn, $repo, $configHandler, $instanceManager, $request); $this->assertInstanceOf('Xpressengine\\Document\\ConfigHandler', $handler->getConfigHandler()); $this->assertInstanceOf('Xpressengine\\Document\\RepositoryInterface', $handler->getRepository()); $this->assertInstanceOf('Xpressengine\\Document\\InstanceManager', $handler->getInstanceManager()); }