classSelectCompiler
final class SelectCompiler
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
Compiles a read after all query mutations have run.
Constants§
public const READS = ['get', 'all', 'first', 'firstorfail', 'find', 'findorfail', 'sole', 'value', '…The execution calls this compiler reads as one SELECT.
Methods§
public function __construct(private Grammar $grammar)Uses the configured framework SQL grammar.
Parameters
$grammar | Grammar |
public function compile(
QueryState $state,
string $method,
list<Domain> $arguments,
): array{Domain, Domain}Parameters
$state | QueryState | |
$method | string | |
$arguments | list<Domain> |
Test cases 5
SelectCompilerTest::testCompileFindUsesTheQualifiedKeyAndOneRowLimitcallsSelectCompilerTest::testCompileHonorsTerminalColumnsAndAggregateArgumentscallsSelectCompilerTest::testCompileKeepsMissingFindKeysAndExcessPluckArgumentsOpencallsSelectCompilerTest::testCompilePreservesExplicitProjectionAndWrapsExistscallsSelectCompilerTest::testPageWindowsChunksByTheLoopAndPagesByTheRequestcalls
Called from 1
Calls 13
- function-call
in_arrayline 36 - static-call Domain::literal() line 37
- method-call SelectCompiler::key() line 43
- static-call Domain::unknown() line 43
- function-call
array_sliceline 44 - method-call SelectCompiler::page() line 47
- method-call SelectCompiler::aggregate() line 51
- static-call QueryState::list() line 54
- method-call Clauses::select() line 55
- new Clauses line 55
- function-call
countline 57 - method-call SelectCompiler::select() line 60
- method-call Grammar::wrap() line 62
public function key(QueryState $state, Domain $id): QueryStateThe primary key predicate of a find: one row for a scalar, a list for an array.
Parameters
$state | QueryState | |
$id | Domain |
Returns
Test cases 1
Called from 2
Calls 12
- new Predicates line 73
- method-call Domain::soleArray() line 74
- method-call Domain::type() line 74
- method-call QueryState::string() line 75
- method-call Predicates::basic() line 76
- method-call QueryState::get() line 76
- static-call Domain::literal() line 76
- function-call
in_arrayline 79 - method-call Predicates::in() line 80
- method-call Predicates::add() line 88
- method-call Grammar::wrap() line 91
- method-call Grammar::join() line 91
public function page(QueryState $state, string $method, list<Domain> $arguments): QueryStateParameters
$state | QueryState | |
$method | string | |
$arguments | list<Domain> | The page window of a chunked or paginated read; the page itself comes from the request or the loop. |
Returns
Test cases 1
Called from 1
Calls 9
- function-call
in_arrayline 99 - static-call Domain::literal() line 100
- function-call
is_intline 107 - method-call Clauses::number() line 110
- new Clauses line 110
- static-call Domain::opaque() line 112
- static-call TypeShape::of() line 112
- class-const Origin::Loop() line 112
- class-const Origin::External() line 112
public function select(QueryState $state): array{Domain, Domain}Parameters
$state | QueryState |
Test cases 3
Called from 3
- method-call SqlCatalog\Extension\Laravel\SelectCompiler::compile() packages/sql-catalog/src/Extension/Laravel/SelectCompiler.php:60
- method-call SqlCatalog\Extension\Laravel\SelectCompiler::aggregate() packages/sql-catalog/src/Extension/Laravel/SelectCompiler.php:162
- method-call SqlCatalog\Extension\Laravel\SelectCompiler::total() packages/sql-catalog/src/Extension/Laravel/SelectCompiler.php:177
Calls 8
- static-call Domain::literal() line 120
- method-call QueryState::get() line 120
- method-call Grammar::join() line 121
- method-call QueryState::items() line 121
- method-call Grammar::wrap() line 121
- function-call
in_arrayline 124 - function-call
array_mergeline 136 - static-call QueryState::list() line 142
public function aggregate(
QueryState $state,
string $method,
list<Domain> $arguments,
): array{Domain, Domain}Parameters
$state | QueryState | |
$method | string | |
$arguments | list<Domain> |
Test cases 2
Called from 2
Calls 6
- function-call
countline 151 - method-call QueryState::items() line 151
- static-call Domain::literal() line 154
- method-call Grammar::wrap() line 156
- static-call QueryState::list() line 157
- method-call SelectCompiler::select() line 162
public function total(QueryState $state): array{Domain, Domain}Parameters
$state | QueryState |
Returns
Test cases 1
Called from 1
Calls 7
- static-call Domain::literal() line 170
- static-call QueryState::list() line 170
- method-call SelectCompiler::aggregate() line 172
- method-call Clauses::select() line 175
- new Clauses line 175
- method-call SelectCompiler::select() line 177
- method-call Grammar::wrap() line 178
Private surface 1§
Implementation details, listed for orientation only.
private Grammar $grammarTest cases 15§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 11
SelectCompilerTest::testAggregateQuotesTheResultAliasAndDiscardsProjectionBindingscallsSelectCompilerTest::testCompileFindUsesTheQualifiedKeyAndOneRowLimitcallsSelectCompilerTest::testCompileHonorsTerminalColumnsAndAggregateArgumentscallsSelectCompilerTest::testCompileKeepsMissingFindKeysAndExcessPluckArgumentsOpencallsSelectCompilerTest::testCompilePreservesExplicitProjectionAndWrapsExistscallsSelectCompilerTest::testKeyComparesScalarsAndListsAgainstThePrimaryKeycallsSelectCompilerTest::testPageWindowsChunksByTheLoopAndPagesByTheRequestcallsSelectCompilerTest::testSelectAssemblesAllComponentsAndBindingGroupsInSqlOrdercallsSelectCompilerTest::testSelectPreservesExplicitOffsetsAndComponentBindingOrdercallsSelectCompilerTest::testSelectWritesUnresolvedLimitsAndOffsetsAsGapscallsSelectCompilerTest::testTotalCountsWithoutTheWindowOrOrderingcalls
Other tests reaching this symbol 4
BuilderCallsTestcallsBuilderQueriesTestcallsCallModelTestcallsAnalyzerTestcalls
Relations§
Instantiated in 3
- new SqlCatalog\Extension\Laravel\BuilderCalls::execution() packages/sql-catalog/src/Extension/Laravel/BuilderCalls.php:261
- new SqlCatalog\Extension\Laravel\BuilderQueries::outputs() packages/sql-catalog/src/Extension/Laravel/BuilderQueries.php:80
- new SqlCatalog\Extension\Laravel\BuilderQueries::dispatch() packages/sql-catalog/src/Extension/Laravel/BuilderQueries.php:135
Method calls 3
- method-call SqlCatalog\Extension\Laravel\BuilderCalls::execution() packages/sql-catalog/src/Extension/Laravel/BuilderCalls.php:261
- method-call SqlCatalog\Extension\Laravel\BuilderQueries::outputs() packages/sql-catalog/src/Extension/Laravel/BuilderQueries.php:80
- method-call SqlCatalog\Extension\Laravel\BuilderQueries::dispatch() packages/sql-catalog/src/Extension/Laravel/BuilderQueries.php:135