Attributes
Reference for AsDataTable and Column PHP attributes
#[AsDataTable]
Target: class
#[AsDataTable(User::class, serializationGroups: ['user:list'], mercure: true, apiPlatform: true)]
#[AsDataTable(
entityClass: User::class,
mercure: [
'topics' => [
'https://example.com/users',
],
],
)]
Arguments:
| Argument | Type | Default | Description |
|---|---|---|---|
entityClass | string | required | Doctrine entity class linked to the table |
serializationGroups | string[] | [] | API Platform serialization groups used during column auto-detection (requires apiPlatform: true) |
mercure | bool|array | false | Enable automatic Mercure config resolution (true) or declare explicit Mercure options (topics, withCredentials, debounceMs) |
apiPlatform | bool | false | Opt-in to API Platform integration: auto Ajax URL wiring and column auto-detection from API Platform metadata |
editModalTemplate | string | '' | Optional Twig template path for the inline edit modal |
editModalAdapter | string | '' | Optional modal adapter override (bootstrap, custom, …) |
Use this attribute to:
- auto-configure the Doctrine data provider used internally by
AbstractDataTable - opt-in to API Platform-driven column auto-detection (
apiPlatform: truerequired) - opt-in to automatic API collection URL resolution for Ajax wiring (
apiPlatform: truerequired) - auto-attach a Mercure config when Mercure is enabled for the table
- declare explicit Mercure topics with
mercure: ['topics' => [...]]
#[Column]
Target: property
#[Column(title: 'Email', searchable: true, orderable: true)]
private string $email;
Arguments:
| Group | Arguments |
|---|---|
| Identity | type, name, title |
| Visibility and behavior | orderable, searchable, visible, exportable, globalSearchable, hideWhenUpdating |
| Rendering | width, className, cellType, defaultContent, renderAsBadges, responsivePriority |
| Data mapping | field, format, position |
Use this attribute when you want column metadata close to your entity model.