getModel() public method

Proxy, Division 관련 설정이 된 Document model 반환 Document 는 config 를 설정해야 정상 사용 가능함 document model 를 직접 반환하지 않음
public getModel ( string $instanceId = null ) : Document
$instanceId string document instance id
return Xpressengine\Document\Models\Document
 /**
  * 게시판 요약 정보 반환
  *
  * @param string  $instanceId instance id
  * @param Handler $handler    board handler
  * @return string
  */
 public function summary($instanceId, Handler $handler)
 {
     $documentCount = $this->document->getModel($instanceId)->where('instanceId', $instanceId)->count();
     $configs = $this->configHandler->getDynamicFields($this->configHandler->get($instanceId));
     $dynamicFieldCount = count($configs);
     return ['documentCount' => $documentCount, 'dynamicFieldCount' => $dynamicFieldCount];
 }
Example #2
0
 /**
  * getPageEntity
  *
  * @param string $pageId page instance id
  * @param string $mode   'pc' or 'mobile'
  * @param string $locale locale
  *
  * @return PageEntity|null
  */
 public function getPageEntity($pageId, $mode, $locale)
 {
     $config = $this->getPageConfig($pageId);
     $documentIds = $config->get('pcUids');
     if ($mode == 'mobile') {
         $documentIds = $config->get('mobileUids');
     }
     if (isset($documentIds[$locale])) {
         $documentId = $documentIds[$locale];
     } else {
         $documentId = array_shift($documentIds);
     }
     $model = $this->document->getModel($pageId);
     $doc = $model->where('id', $documentId)->where('locale', $locale)->first();
     if ($doc == null) {
         return null;
     }
     $pageEntity = new PageEntity(['pageId' => $pageId, 'uid' => $documentId, 'content' => $doc]);
     return $pageEntity;
 }