Skip to content

Commit c14718e

Browse files
author
Pantea Marius-ciclistu
committed
Improvement
1 parent fc09e04 commit c14718e

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/Models/BaseModel.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,22 +254,25 @@ function () use ($driver): array {
254254

255255
public function retrieveFirstSeqIndexedColumns(): array
256256
{
257-
try {
258-
static $indexes;
257+
static $indexes;
259258

260-
$result = $indexes[$this->getConnectionName() . $this->getTable()] ??=
261-
$this->retrieveIndexesFromTable()->where('Seq_in_index', 1)->pluck('Column_name')->all();
259+
try {
260+
$result = $indexes[$this->getConnectionName() . $this->getTable()] ??= \array_values(\array_unique(
261+
$this->retrieveIndexesFromTable()->where('Seq_in_index', 1)->pluck('Column_name')->all()
262+
));
262263
} catch (\Throwable $e) {
263264
if (GeneralHelper::isDebug()) {
264265
Log::error($this::class . ' error getting indexes: ' . $e->getMessage());
265266
}
266267
}
267268

268-
if (\count($result ?? []) === 0) {
269+
if (($result ??= []) === [] && $this->indexRequiredOnFiltering) {
269270
$this->indexRequiredOnFiltering = false;
271+
272+
return [];
270273
}
271274

272-
return \array_values(\array_unique($result ?? []));
275+
return $result;
273276
}
274277

275278
/**

0 commit comments

Comments
 (0)