Attributes
#[AsDataTable]
Target: class
#[AsDataTable(User::class, serializationGroups: ['user:list'], mercure: true)]
Arguments:
| Argument | Type | Default | Description |
|---|---|---|---|
| `entityClass` | `string` | required | Doctrine entity class linked to the table |
| `serializationGroups` | `string[]` | `[]` | API Platform serialization groups for auto-detection |
| `mercure` | `bool` | `false` | Enable automatic Mercure config resolution for the table |
Use this attribute to:
- auto-configure the Doctrine data provider used internally by
AbstractDataTable - enable API Platform-driven column auto-detection
- resolve API collection URL for auto Ajax wiring
- auto-attach a Mercure config when Mercure is enabled for the table
#[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` |
| Rendering | `width`, `className`, `cellType`, `render`, `defaultContent` |
| Data mapping | `field`, `format`, `priority` |
Use this attribute when you want column metadata close to your entity model.