Collection Annotations
Document binding and database/cache controller routing.
Collection Database
Maps a Collection to its Document class and optionally selects database and cache controller implementations.
| Parameter | Type | Default | Behavior |
|---|---|---|---|
| document | string | Required | Document class handled by this Collection. |
| database | string|null | null | Optional database controller class; otherwise the default is used. |
| cache | string|null | null | Optional database cache controller class; otherwise the default is used. |
use Core\Collection\Annotation\Database;
#[Database(
document: Product::class,
database: ProductDatabase::class,
cache: ProductDatabaseCache::class
)]
class ProductCollection extends \Core\Collection\Base {}
Relationship
The Document Database annotation points from a Document to a Collection; the Collection Database annotation points from a Collection to its Document and optionally specifies controller implementations. Both sides have distinct responsibilities.