What problem does it solve?
This skill streamlines building Active Record-style ORM models in ColdBox/BoxLang, reducing repetitive boilerplate and preventing common pitfalls such as mass-assignment vulnerabilities, N+1 query performance issues, and inconsistent lifecycle side effects.
Core Features & Use Cases
- Entity definition & safety: define table-backed entities with _fillable, _hidden, and type casting to enforce safe serialization and mass-assignment protection.
- Relationships & querying: declare hasOne, hasMany, belongsTo, and belongsToMany relationships, write reusable query scopes, and eager-load nested relations to prevent N+1 queries.
- Lifecycle hooks & transformations: implement accessors/mutators and before/after hooks for consistent side effects like auditing, job dispatch, and automatic timestamping.
- Use case: implement a User entity with posts, profile, and permissions, use scopes for common filters, eager-load relationships for listing pages, and run lifecycle hooks to dispatch welcome emails and record audits.
Quick Start
Create a User entity with fillable fields, define posts and profile relationships, and fetch active users with posts eagerly loaded.