create document instance
public createInstance ( string $instanceId, array $params = [] ) : |
||
$instanceId | string | instance id |
$params | array | parameters |
리턴 |
/** * 게시판 생성 * * @param array $params parameters * @return ConfigEntity */ public function create(array $params) { if (empty($params['boardId']) === true) { throw new RequiredValueException(['key' => 'boardId']); } $config = $this->configHandler->get($params['boardId']); if ($config !== null) { throw new AlreadyExistsInstanceException(); } $this->conn->beginTransaction(); $documentConfig = $this->document->createInstance($params['boardId'], $params); // create comment config(create new comment instance) $this->commentHandler->createInstance($documentConfig->get('instanceId'), $documentConfig->get('division')); $this->commentHandler->configure($this->commentHandler->getInstanceId($documentConfig->get('instanceId')), ['useWysiwyg' => true]); $params['documentGroup'] = $documentConfig->get('group'); $params['commentGroup'] = 'comments_' . $documentConfig->get('instanceId'); $config = $this->configHandler->add($params); $this->permissionHandler->setByInstanceId($params['boardId'], new Grant()); $this->conn->commit(); return $config; }