Skip to content

Commit c31d5c2

Browse files
committed
Improve naming
1 parent 1b981ea commit c31d5c2

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/GenericModel.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ public static function query(Query $query): QueryResult
482482
}
483483

484484
if (static::$registry) {
485-
if ($query instanceof SelectQuery && $result->wasSuccessful() && $query->shouldSaveResults()) {
485+
if ($query instanceof SelectQuery && $result->wasSuccessful() && $query->shouldSaveResultsToRegistry()) {
486486
foreach ($result as $model) {
487487
if ($model->getId() === null) {
488488
continue;
@@ -520,9 +520,9 @@ public static function select(null|WhereCondition|array|WhereGroup $where = null
520520
null|array $fields = null,
521521
null|Limit|array|int $limit = null,
522522
null|array $group = null,
523-
bool $saveResults = true): QueryResult
523+
bool $saveResultsToRegistry = true): QueryResult
524524
{
525-
return static::query(new SelectQuery($where, $order, $fields, $limit, $group, $saveResults));
525+
return static::query(new SelectQuery($where, $order, $fields, $limit, $group, $saveResultsToRegistry));
526526
}
527527

528528
/**

src/Query/SelectQuery.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ class SelectQuery extends Query
2323
* @param array|null $fields
2424
* @param array|int|Limit|null $limit
2525
* @param array|GroupField[]|string[]|null $group
26-
* @param bool $saveResults Whether results of this query should be saved in the model registry.
26+
* @param bool $saveResultsToRegistry Whether results of this query should be saved in the model registry.
2727
*/
2828
public function __construct(null|WhereCondition|array|WhereGroup $where = null,
2929
null|array $order = null,
3030
null|array $fields = null,
3131
null|Limit|array|int $limit = null,
3232
null|array $group = null,
33-
protected bool $saveResults = true)
33+
protected bool $saveResultsToRegistry = true)
3434
{
3535
if ($where) {
3636
$this->where($where);
@@ -106,9 +106,9 @@ public function getGroup(): ?array
106106
* @param bool $saveResults
107107
* @return $this
108108
*/
109-
public function saveResults(bool $saveResults = true): static
109+
public function saveResultsToRegistry(bool $saveResults = true): static
110110
{
111-
$this->saveResults = $saveResults;
111+
$this->saveResultsToRegistry = $saveResults;
112112
return $this;
113113
}
114114

@@ -117,8 +117,8 @@ public function saveResults(bool $saveResults = true): static
117117
*
118118
* @return bool
119119
*/
120-
public function shouldSaveResults(): bool
120+
public function shouldSaveResultsToRegistry(): bool
121121
{
122-
return $this->saveResults;
122+
return $this->saveResultsToRegistry;
123123
}
124124
}

0 commit comments

Comments
 (0)