Skip to content

Commit

Permalink
potential new direction
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmitchell committed Dec 6, 2024
1 parent 99035d8 commit 4a564fd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Fieldtypes/Entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use Statamic\Facades\User;
use Statamic\Http\Resources\CP\Entries\EntriesFieldtypeEntries;
use Statamic\Http\Resources\CP\Entries\EntriesFieldtypeEntry as EntryResource;
use Statamic\Query\EmptyQueryBuilder;
use Statamic\Query\EmptyEntryQueryBuilder;
use Statamic\Query\OrderedQueryBuilder;
use Statamic\Query\Scopes\Filter;
use Statamic\Query\Scopes\Filters\Concerns\QueriesFilters;
Expand Down Expand Up @@ -339,7 +339,7 @@ protected function collect($value)
private function queryBuilder($values)
{
if (! $values) {
return new StatusQueryBuilder(new EmptyQueryBuilder());
return new StatusQueryBuilder(new EmptyEntryQueryBuilder());
}

$site = Site::current()->handle();
Expand Down
16 changes: 16 additions & 0 deletions src/Query/EmptyEntryQueryBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Statamic\Query;

use Statamic\Contracts\Entries\QueryBuilder;
use Statamic\Stache\Query\QueriesTaxonomizedEntries;

class EmptyEntryQueryBuilder extends EmptyQueryBuilder implements QueryBuilder
{
use QueriesTaxonomizedEntries;

public function whereStatus($status)
{
return $this;
}
}
5 changes: 0 additions & 5 deletions src/Query/EmptyQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,4 @@ protected function getBaseItems()
{
return collect([]);
}

public function whereStatus($status)
{
return $this;
}
}
4 changes: 2 additions & 2 deletions src/Stache/Query/QueriesEntryStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Illuminate\Support\Collection;
use Statamic\Exceptions\InvalidQueryDateException;
use Statamic\Query\EmptyQueryBuilder;
use Statamic\Query\EmptyEntryQueryBuilder;

trait QueriesEntryStatus
{
Expand Down Expand Up @@ -32,7 +32,7 @@ public function whereStatus(string $status)
try {
return $query->orWhere(fn ($q) => $this->addCollectionStatusLogicToQuery($q, $status, $collection));
} catch (InvalidQueryDateException $e) {
return new EmptyQueryBuilder();
return new EmptyEntryQueryBuilder();
}
})
);
Expand Down

0 comments on commit 4a564fd

Please sign in to comment.