/** * 게시판 설정 변경 * * @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; }