Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Collection.php
Go to the documentation of this file.
1 <?php
13 
19 {
25  protected $_storeIds;
26 
32  protected function _construct()
33  {
34  $this->_init(\Magento\Reports\Model\Event::class, \Magento\Reports\Model\ResourceModel\Event::class);
35  }
36 
44  public function addStoreFilter(array $storeIds)
45  {
46  $this->_storeIds = $storeIds;
47  return $this;
48  }
49 
60  public function addRecentlyFiler($typeId, $subjectId, $subtype = 0, $ignore = null, $limit = 15)
61  {
62  $stores = $this->getResource()->getCurrentStoreIds($this->_storeIds);
63  $select = $this->getSelect();
64  $select->where(
65  'event_type_id = ?',
66  $typeId
67  )->where(
68  'subject_id = ?',
69  $subjectId
70  )->where(
71  'subtype = ?',
72  $subtype
73  )->where(
74  'store_id IN(?)',
75  $stores
76  );
77  if ($ignore) {
78  if (is_array($ignore)) {
79  $select->where('object_id NOT IN(?)', $ignore);
80  } else {
81  $select->where('object_id <> ?', $ignore);
82  }
83  }
84  $select->group('object_id')->limit($limit);
85  return $this;
86  }
87 }
addRecentlyFiler($typeId, $subjectId, $subtype=0, $ignore=null, $limit=15)
Definition: Collection.php:60