abstract | |
|---|---|
readonly | |
extends |
SqlEntitySetResolver |
implements |
CustomEntitySetInterface, SqlQueryInterface |
Declarative base class for SQL-backed custom entity sets.
Subclasses declare their schema via {@see columns()} and {@see key()}, and provide the SQL source via {@see query()}. The entity type is assembled automatically — no manual EDM construction needed.
Example:
final readonly class BillableProjects extends AbstractEntitySet { public function entitySetName(): string { return 'BillableProjects'; }
public function key(): array { return ['project_id']; }
public function columns(): array { return [ 'project_id' => EdmPrimitiveType::Int64, 'customer' => EdmPrimitiveType::String, 'tier' => LicenseTier::class, // int-backed PHP enum 'hours_posted' => EdmPrimitiveType::Double, ]; }
public function query(): Builder { return DB::query()->fromSub($sql, 't'); } }
The entity type name is derived by singularizing {@see entitySetName()} (e.g. BillableProjects → BillableProject). Override {@see entityType()} for full control over entity type construction (custom names, navigation properties, annotations, non-standard key configurations).
| Methods | ||
|---|---|---|
public
|
__construct()
|
# |
abstract
public
|
columns(): array<string, EdmPrimitiveType|class-string<BackedEnum>>
|
# |
public
|
key(): list<string>
|
# |
public
|
entityType(string $namespace): EntityTypeInterface
|
# |
| Methods inherited from LaravelUi5\OData\Driver\Sql\SqlEntitySetResolver |
|---|
resolve(), resolveOne(), count() |