Problem
Ray.MediaQuery currently supports parameter injection for omitted optional object parameters.
#[DbQuery('todo_add')]
public function add(string $title, ?Uuid $id = null): void;
When called as:
$repository->add('Buy milk');
$id is resolved from DI.
This is convenient, but the method signature does not clearly communicate whether $id is intended to be:
- a SQL bind parameter supplied by the caller, or
- a DI-injected parameter supplied by MediaQuery.
Proposal
Support an explicit injection marker for MediaQuery parameters:
#[DbQuery('todo_add')]
public function add(
string $title,
#[Inject] ?Uuid $id = null
): void;
#[Inject] would document that the parameter is intentionally resolved from DI when omitted.
Backward compatibility
This does not need to be a breaking change initially.
Suggested migration path:
- Add support for
#[Inject].
- Continue supporting current implicit injection behavior.
- Emit a notice / deprecation notice / logger warning when MediaQuery performs implicit DI for an omitted object parameter without
#[Inject].
- In a future major version, consider requiring
#[Inject] for injected parameters.
Motivation
This makes MediaQuery interfaces more self-documenting and avoids ambiguity between SQL input parameters and DI-provided parameters.
It also helps IDEs, static analysis, and code generators understand which parameters are caller-supplied and which are injected.
Problem
Ray.MediaQuery currently supports parameter injection for omitted optional object parameters.
When called as:
$idis resolved from DI.This is convenient, but the method signature does not clearly communicate whether
$idis intended to be:Proposal
Support an explicit injection marker for MediaQuery parameters:
#[Inject]would document that the parameter is intentionally resolved from DI when omitted.Backward compatibility
This does not need to be a breaking change initially.
Suggested migration path:
#[Inject].#[Inject].#[Inject]for injected parameters.Motivation
This makes MediaQuery interfaces more self-documenting and avoids ambiguity between SQL input parameters and DI-provided parameters.
It also helps IDEs, static analysis, and code generators understand which parameters are caller-supplied and which are injected.