Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function preBuildUnit()
- {
- $entryIds = array();
- $blogIds = array();
- $userIds = array();
- $categoryIds = array();
- foreach ($this->entries as $entry) {
- if (!empty($entry['entry_id'])) $entryIds[] = $entry['entry_id'];
- if (!empty($entry['entry_blog_id'])) $blogIds[] = $entry['entry_blog_id'];
- if (!empty($entry['entry_user_id'])) $userIds[] = $entry['entry_user_id'];
- if (!empty($entry['entry_category_id'])) $categoryIds[] = $entry['entry_category_id'];
- }
- // メイン画像のEagerLoading
- if (!isset($this->_config['mainImageOn']) || $this->_config['mainImageOn'] === 'on') {
- $this->eagerLoadingData['mainImage'] = Tpl::eagerLoadMainImage($this->entries);
- }
- // フルテキストのEagerLoading
- if (!isset($this->_config['fullTextOn']) || $this->_config['fullTextOn'] === 'on') {
- $this->eagerLoadingData['fullText'] = Tpl::eagerLoadFullText($entryIds);
- }
- // タグのEagerLoading
- $this->eagerLoadingData['tag'] = Tpl::eagerLoadTag($entryIds);
- // エントリーフィールドのEagerLoading
- if (!isset($this->_config['entryFieldOn']) || $this->_config['entryFieldOn'] === 'on') {
- $this->eagerLoadingData['entryField'] = eagerLoadField($entryIds, 'eid');
- }
- // ユーザーフィールドのEagerLoading
- if (isset($this->_config['userInfoOn']) && $this->_config['userInfoOn'] === 'on') {
- $this->eagerLoadingData['userField'] = eagerLoadField($userIds, 'uid');
- }
- // ブログフィールドのEagerLoading
- if (isset($this->_config['blogInfoOn']) && $this->_config['blogInfoOn'] === 'on') {
- $this->eagerLoadingData['blogField'] = eagerLoadField($blogIds, 'bid');
- }
- // カテゴリーフィールドのEagerLoading
- if (isset($this->_config['categoryInfoOn']) && $this->_config['categoryInfoOn'] === 'on') {
- $this->eagerLoadingData['categoryField'] = eagerLoadField($categoryIds, 'cid');
- }
- // サブカテゴリーのEagerLoading
- if (isset($this->_config['categoryInfoOn']) && $this->_config['categoryInfoOn'] === 'on') {
- $this->eagerLoadingData['subCategory'] = eagerLoadSubCategories($entryIds);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement