← ClaudeAtlas

create-controller-listinglisted

Create the listing page actions in the admin controller: index (grid with filters), delete, toggle status, and any bulk actions the entity requires. Trigger: "create listing for {Domain}", "create index action for {Domain}".
jeffsenso/prestashop-skills · ★ 4 · AI & Automation · score 76
Install: claude install-skill jeffsenso/prestashop-skills
# create-controller-listing Read `@.ai/Component/Controller/CONTEXT.md` for controller conventions (base class, DI, security attributes, error mapping). Read `@.ai/Component/Grid/CONTEXT.md` for grid patterns (definition factory, query builder, filters). ## 1. Index action ```php #[AdminSecurity("is_granted('read', request.get('_legacy_controller'))")] public function indexAction({Domain}Filters $filters): Response ``` - Use the `{Domain}Filters` class as action argument — automatically resolved by the argument resolver - Build grid via the grid factory service, present it, render the index template - No manual `SearchCriteria` construction needed **Reference:** `TaxController::indexAction()`, `ManufacturerController::indexAction()` ## 2. Search and reset - **Search/filter:** `CommonController::searchGridAction` saves and applies grid filters, then redirects back to the domain's index action. A domain-specific route must be defined pointing to this generic controller action (see `create-admin-routing`) - **Filter reset:** uses the generic route `admin_common_reset_search_by_filter_id` — no domain-specific route or controller code needed. Referenced from the `GridDefinition` ## 3. Delete action ```php #[AdminSecurity("is_granted('delete', request.get('_legacy_controller'))")] public function deleteAction(int ${domain}Id): RedirectResponse ``` - Dispatch `Delete{Domain}Command` via command bus - Catch `{Domain}NotFoundException` and `CannotDelete{Domain}Exception` - F