5
5
*/
6
6
namespace Magento \Customer \Model \Indexer ;
7
7
8
+ use Magento \Customer \Model \ResourceModel \Customer \Indexer \CollectionFactory ;
8
9
use Magento \Customer \Model \ResourceModel \Customer \Indexer \Collection ;
9
10
use Magento \Framework \App \ResourceConnection \SourceProviderInterface ;
10
11
use Traversable ;
@@ -25,35 +26,35 @@ class Source implements \IteratorAggregate, \Countable, SourceProviderInterface
25
26
private $ batchSize ;
26
27
27
28
/**
28
- * @param \Magento\Customer\Model\ResourceModel\Customer\Indexer\ CollectionFactory $collection
29
+ * @param CollectionFactory $collectionFactory
29
30
* @param int $batchSize
30
31
*/
31
32
public function __construct (
32
- \ Magento \ Customer \ Model \ ResourceModel \ Customer \ Indexer \ CollectionFactory $ collectionFactory ,
33
+ CollectionFactory $ collectionFactory ,
33
34
$ batchSize = 10000
34
35
) {
35
36
$ this ->customerCollection = $ collectionFactory ->create ();
36
37
$ this ->batchSize = $ batchSize ;
37
38
}
38
39
39
40
/**
40
- * { @inheritdoc}
41
+ * @inheritdoc
41
42
*/
42
43
public function getMainTable ()
43
44
{
44
45
return $ this ->customerCollection ->getMainTable ();
45
46
}
46
47
47
48
/**
48
- * { @inheritdoc}
49
+ * @inheritdoc
49
50
*/
50
51
public function getIdFieldName ()
51
52
{
52
53
return $ this ->customerCollection ->getIdFieldName ();
53
54
}
54
55
55
56
/**
56
- * { @inheritdoc}
57
+ * @inheritdoc
57
58
*/
58
59
public function addFieldToSelect ($ fieldName , $ alias = null )
59
60
{
@@ -62,15 +63,15 @@ public function addFieldToSelect($fieldName, $alias = null)
62
63
}
63
64
64
65
/**
65
- * { @inheritdoc}
66
+ * @inheritdoc
66
67
*/
67
68
public function getSelect ()
68
69
{
69
70
return $ this ->customerCollection ->getSelect ();
70
71
}
71
72
72
73
/**
73
- * { @inheritdoc}
74
+ * @inheritdoc
74
75
*/
75
76
public function addFieldToFilter ($ attribute , $ condition = null )
76
77
{
@@ -79,7 +80,7 @@ public function addFieldToFilter($attribute, $condition = null)
79
80
}
80
81
81
82
/**
82
- * @return int
83
+ * @inheritdoc
83
84
*/
84
85
public function count ()
85
86
{
@@ -105,4 +106,28 @@ public function getIterator()
105
106
$ pageNumber ++;
106
107
} while ($ pageNumber <= $ lastPage );
107
108
}
109
+
110
+ /**
111
+ * Joins Attribute
112
+ *
113
+ * @param string $alias alias for the joined attribute
114
+ * @param string|\Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute
115
+ * @param string $bind attribute of the main entity to link with joined $filter
116
+ * @param string|null $filter primary key for the joined entity (entity_id default)
117
+ * @param string $joinType inner|left
118
+ * @param int|null $storeId
119
+ * @return void
120
+ * @throws \Magento\Framework\Exception\LocalizedException
121
+ * @see Collection::joinAttribute()
122
+ */
123
+ public function joinAttribute (
124
+ string $ alias ,
125
+ $ attribute ,
126
+ string $ bind ,
127
+ ?string $ filter = null ,
128
+ string $ joinType = 'inner ' ,
129
+ ?int $ storeId = null
130
+ ): void {
131
+ $ this ->customerCollection ->joinAttribute ($ alias , $ attribute , $ bind , $ filter , $ joinType , $ storeId );
132
+ }
108
133
}
0 commit comments