Skip to content

Commit 1eefcbd

Browse files
committed
Revert "Fix taxonomy null caching and ensure taxonomy column in term queries"
This reverts commit 28bed54.
1 parent 8668ada commit 1eefcbd

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

src/Taxonomies/TaxonomyRepository.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,11 @@ public function all(): Collection
4040

4141
public function findByHandle($handle): ?TaxonomyContract
4242
{
43-
$blinkKey = "eloquent-taxonomies-{$handle}";
44-
$taxonomyModel = Blink::once($blinkKey, function () use ($handle) {
43+
$taxonomyModel = Blink::once("eloquent-taxonomies-{$handle}", function () use ($handle) {
4544
return app('statamic.eloquent.taxonomies.model')::whereHandle($handle)->first();
4645
});
4746

48-
if (! $taxonomyModel instanceof Model) {
49-
Blink::forget($blinkKey);
50-
51-
return null;
52-
}
53-
54-
return app(TaxonomyContract::class)->fromModel($taxonomyModel);
47+
return $taxonomyModel instanceof Model ? app(TaxonomyContract::class)->fromModel($taxonomyModel) : null;
5548
}
5649

5750
public function findByUri(string $uri, ?string $site = null): ?Taxonomy

src/Taxonomies/TermQueryBuilder.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,6 @@ public function get($columns = ['*'])
174174
{
175175
$this->applyCollectionAndTaxonomyWheres();
176176

177-
// Ensure 'taxonomy' is always selected as it's required for Term::fromModel().
178-
if (! in_array('*', $columns) && ! in_array('taxonomy', $columns)) {
179-
$columns[] = 'taxonomy';
180-
}
181-
182177
$items = parent::get($columns);
183178

184179
// If a single collection has been queried, we'll supply it to the terms so
@@ -217,11 +212,6 @@ public function paginate($perPage = null, $columns = [], $pageName = 'page', $pa
217212
{
218213
$this->applyCollectionAndTaxonomyWheres();
219214

220-
// Ensure 'taxonomy' is always selected as it's required for Term::fromModel().
221-
if (! in_array('*', $columns) && ! in_array('taxonomy', $columns)) {
222-
$columns[] = 'taxonomy';
223-
}
224-
225215
return parent::paginate($perPage, $columns, $pageName, $page);
226216
}
227217

0 commit comments

Comments
 (0)