Class LaravelUi5\Sdk\Http\Middleware\BindSdkContextForOData

final
readonly

Bridges Core's OData middleware chain to SDK's SdkUi5ContextFactory.

Core's ResolveUi5Context middleware (on the ui5/ prefix) invokes Ui5ContextFactoryInterface::build(), which — under SDK — binds SdkContext into the container. The OData chain (odata/ prefix) has no equivalent step, so OData requests reach ScopedAbstractEntitySet with no SdkContext bound; RoleScopeApplier::resolveActorId() then catches BindingResolutionException, returns null, and the scope falls through to 1 = 0 — every scoped OData query returns empty.

This middleware closes that gap by invoking the same factory the UI5 prefix uses. SdkUi5ContextFactory does the actual binding as a side effect of build().

Every service that is an artifact gets its context: an app, and since Core 8.1 a library that serves data (AbstractUi5ODataLibrary). So the read authorizer decides for a library as for an app — open to every signed-in user when the library carries no #[Access] — instead of opting out for want of a context.

Place AFTER ResolveODataEndpoint (which binds ODataServiceInterface) and AFTER EnsureODataAuthenticated (factory throws on no auth).

Methods