Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. function preBuildUnit()
  2. {
  3. $entryIds = array();
  4. $blogIds = array();
  5. $userIds = array();
  6. $categoryIds = array();
  7.  
  8. foreach ($this->entries as $entry) {
  9. if (!empty($entry['entry_id'])) $entryIds[] = $entry['entry_id'];
  10. if (!empty($entry['entry_blog_id'])) $blogIds[] = $entry['entry_blog_id'];
  11. if (!empty($entry['entry_user_id'])) $userIds[] = $entry['entry_user_id'];
  12. if (!empty($entry['entry_category_id'])) $categoryIds[] = $entry['entry_category_id'];
  13. }
  14.  
  15. // メイン画像のEagerLoading
  16. if (!isset($this->_config['mainImageOn']) || $this->_config['mainImageOn'] === 'on') {
  17. $this->eagerLoadingData['mainImage'] = Tpl::eagerLoadMainImage($this->entries);
  18. }
  19. // フルテキストのEagerLoading
  20. if (!isset($this->_config['fullTextOn']) || $this->_config['fullTextOn'] === 'on') {
  21. $this->eagerLoadingData['fullText'] = Tpl::eagerLoadFullText($entryIds);
  22. }
  23. // タグのEagerLoading
  24. $this->eagerLoadingData['tag'] = Tpl::eagerLoadTag($entryIds);
  25. // エントリーフィールドのEagerLoading
  26. if (!isset($this->_config['entryFieldOn']) || $this->_config['entryFieldOn'] === 'on') {
  27. $this->eagerLoadingData['entryField'] = eagerLoadField($entryIds, 'eid');
  28. }
  29. // ユーザーフィールドのEagerLoading
  30. if (isset($this->_config['userInfoOn']) && $this->_config['userInfoOn'] === 'on') {
  31. $this->eagerLoadingData['userField'] = eagerLoadField($userIds, 'uid');
  32. }
  33. // ブログフィールドのEagerLoading
  34. if (isset($this->_config['blogInfoOn']) && $this->_config['blogInfoOn'] === 'on') {
  35. $this->eagerLoadingData['blogField'] = eagerLoadField($blogIds, 'bid');
  36. }
  37. // カテゴリーフィールドのEagerLoading
  38. if (isset($this->_config['categoryInfoOn']) && $this->_config['categoryInfoOn'] === 'on') {
  39. $this->eagerLoadingData['categoryField'] = eagerLoadField($categoryIds, 'cid');
  40. }
  41. // サブカテゴリーのEagerLoading
  42. if (isset($this->_config['categoryInfoOn']) && $this->_config['categoryInfoOn'] === 'on') {
  43. $this->eagerLoadingData['subCategory'] = eagerLoadSubCategories($entryIds);
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement