#[CpResource] auto-admin: a full admin panel from one entity

slaweally 10.09.2026 14:30 0 replies 35 views

Add #[CpResource(name: 'invoice', capabilities: [...])] to a Doctrine entity; under /aacp/resources you get a list, a form, delete and workflow transition buttons for free.

You tune presentation with the #[CpField] property attribute: label, list/form visibility, sortability, widget.

Security side: ResourceFieldResolver refuses password, token, secret, hash, roles, data, tenant_id by name — they never reach the UI. ResourceFormBuilder builds a form only from allowed fields (Law 5.3). Every action is gated by {name}.{cap}, and TenantFilter is automatic.

Doctrine 3 note: a FieldMapping is now an object; the resolver uses property access like $mapping->type, not the deprecated array access.

There is no named #[CpResource] in the project yet; this is pure framework machinery and works for free once the first module arrives.

Forever CPalius **