-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMultiQueryResult.php
More file actions
51 lines (46 loc) · 1.28 KB
/
MultiQueryResult.php
File metadata and controls
51 lines (46 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
namespace Aternos\Model\Query;
class MultiQueryResult extends QueryResult
{
/** @var QueryResult[] */
protected array $queryResults = [];
/**
* Add a QueryResult
*
* If a query string or affected rows are set in the QueryResult, they will overwrite the ones in this MultiQueryResult
*
* @param QueryResult $queryResult
* @return $this
*/
public function addQueryResult(QueryResult $queryResult): static
{
$this->queryResults[] = $queryResult;
if ($queryResult->getQueryString() !== null) {
$this->setQueryString($queryResult->getQueryString());
}
if ($queryResult->getQueryString() !== null) {
$this->setAffectedRows($queryResult->getAffectedRows());
}
return $this;
}
/**
* @param QueryResult[] $queryResults
* @return $this
*/
public function addQueryResults(array $queryResults): static
{
foreach ($queryResults as $queryResult) {
if ($queryResult instanceof QueryResult) {
$this->addQueryResult($queryResult);
}
}
return $this;
}
/**
* @return QueryResult[]
*/
public function getAllQueryResults(): array
{
return $this->queryResults;
}
}