Esempio n. 1
0
 /**
  * create instance
  *
  * @param DocumentHandler     $document      document handler
  * @param DynamicFieldHandler $dynamicField  dynamic field handler
  * @param CommentHandler      $comment       comment handler
  * @param ConfigHandler       $configHandler config handler
  */
 public function __construct(DocumentHandler $document, DynamicFieldHandler $dynamicField, CommentHandler $comment, ConfigHandler $configHandler)
 {
     $this->conn = $document->getRepository()->connection();
     $this->document = $document;
     $this->dynamicField = $dynamicField;
     $this->comment = $comment;
     $this->configHandler = $configHandler;
 }
Esempio n. 2
0
 /**
  * 게시판 이동
  * Document Package 에서 comment 를 지원하지 않아서 사용할 수 있는 인터페이스가 없음
  *
  * @param string         $id             document id
  * @param ConfigEntity   $config         destination board config entity
  * @param CommentHandler $commentHandler comment handler
  */
 public function move($id, ConfigEntity $config, CommentHandler $commentHandler)
 {
     if ($config === null) {
         throw new InvalidConfigException();
     }
     $item = $this->get($id);
     $doc = $item->getDocument();
     $dstInstanceId = $config->get('boardId');
     // 덧글이 있다면 덧글들을 모두 옯긴다.
     // 이거 document 인터페이스 있으멶 좋을까?? 사용 할 일 없어 보이는데.
     $rows = $this->document->getRepository()->getReplies($doc);
     foreach ($rows as $row) {
         $item = $this->get($row['id'], $row['instanceId']);
         $item->instanceId = $dstInstanceId;
         $item->getSlug()->instanceId = $dstInstanceId;
         if ($item->userId == '') {
             $item->userId = '';
         }
         $this->put($item);
         $commentHandler->moveByTarget($dstInstanceId, $item->id);
     }
 }
 /**
  * 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());
 }