Skip to content

Commit 35426fa

Browse files
author
Stanislav Idolov
authored
ENGCOM-3027: [Forwardport] [2.2] return $this from setters in Analytics/ReportXml/DB/SelectBuilder.php #18203
2 parents df29010 + d814e10 commit 35426fa

File tree

2 files changed

+30
-14
lines changed

2 files changed

+30
-14
lines changed

app/code/Magento/Analytics/ReportXml/DB/SelectBuilder.php

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,13 @@ public function getJoins()
8585
* Set joins conditions
8686
*
8787
* @param array $joins
88-
* @return void
88+
* @return $this
8989
*/
9090
public function setJoins($joins)
9191
{
9292
$this->joins = $joins;
93+
94+
return $this;
9395
}
9496

9597
/**
@@ -106,11 +108,13 @@ public function getConnectionName()
106108
* Set connection name
107109
*
108110
* @param string $connectionName
109-
* @return void
111+
* @return $this
110112
*/
111113
public function setConnectionName($connectionName)
112114
{
113115
$this->connectionName = $connectionName;
116+
117+
return $this;
114118
}
115119

116120
/**
@@ -127,11 +131,13 @@ public function getColumns()
127131
* Set columns
128132
*
129133
* @param array $columns
130-
* @return void
134+
* @return $this
131135
*/
132136
public function setColumns($columns)
133137
{
134138
$this->columns = $columns;
139+
140+
return $this;
135141
}
136142

137143
/**
@@ -148,11 +154,13 @@ public function getFilters()
148154
* Set filters
149155
*
150156
* @param array $filters
151-
* @return void
157+
* @return $this
152158
*/
153159
public function setFilters($filters)
154160
{
155161
$this->filters = $filters;
162+
163+
return $this;
156164
}
157165

158166
/**
@@ -169,11 +177,13 @@ public function getFrom()
169177
* Set from condition
170178
*
171179
* @param array $from
172-
* @return void
180+
* @return $this
173181
*/
174182
public function setFrom($from)
175183
{
176184
$this->from = $from;
185+
186+
return $this;
177187
}
178188

179189
/**
@@ -236,11 +246,13 @@ public function getGroup()
236246
* Set group
237247
*
238248
* @param array $group
239-
* @return void
249+
* @return $this
240250
*/
241251
public function setGroup($group)
242252
{
243253
$this->group = $group;
254+
255+
return $this;
244256
}
245257

246258
/**
@@ -257,11 +269,13 @@ public function getParams()
257269
* Set parameters
258270
*
259271
* @param array $params
260-
* @return void
272+
* @return $this
261273
*/
262274
public function setParams($params)
263275
{
264276
$this->params = $params;
277+
278+
return $this;
265279
}
266280

267281
/**
@@ -278,10 +292,12 @@ public function getHaving()
278292
* Set having condition
279293
*
280294
* @param array $having
281-
* @return void
295+
* @return $this
282296
*/
283297
public function setHaving($having)
284298
{
285299
$this->having = $having;
300+
301+
return $this;
286302
}
287303
}

app/code/Magento/Analytics/Test/Unit/ReportXml/DB/SelectBuilderTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ public function testCreate()
6464
['link-type' => 'right', 'table' => 'attribute', 'condition' => 'neq'],
6565
];
6666
$groups = ['id', 'name'];
67-
$this->selectBuilder->setConnectionName($connectionName);
68-
$this->selectBuilder->setFrom($from);
69-
$this->selectBuilder->setColumns($columns);
70-
$this->selectBuilder->setFilters([$filter]);
71-
$this->selectBuilder->setJoins($joins);
72-
$this->selectBuilder->setGroup($groups);
67+
$this->selectBuilder->setConnectionName($connectionName)
68+
->setFrom($from)
69+
->setColumns($columns)
70+
->setFilters([$filter])
71+
->setJoins($joins)
72+
->setGroup($groups);
7373
$this->resourceConnectionMock->expects($this->once())
7474
->method('getConnection')
7575
->with($connectionName)

0 commit comments

Comments
 (0)