Class LaravelUi5\OData\Service\Discovery\Attributes\ODataComputed

final
readonly

Declares a computed property on a discovered model: a property with no column, whose value is an SQL expression.

#[ODataComputed('currency', EdmPrimitiveType::String, maxLength: 3)]
#[ODataAnnotate('price', new ISOCurrency(new Path('currency')))]
class ServiceItem extends Model {}

The declaration is static, so a cached service keeps it. The value comes from the bound {@see \LaravelUi5\OData\Service\Contracts\ColumnExpressionResolverInterface}, asked with the model class and the property name: the engine selects (<expression>) AS <name>, and $filter, $orderby and $search use the same expression. A literal per request (a tenant's base currency) is the resolver's answer. A computed property without an expression fails when it is queried.

The engine annotates the property with Core.Computed. #[ODataAnnotate] reaches it like any column.

Methods
Properties