1
0
Files
breadcrumb-the-shire/lib/Repository/Org/DepartmentRepositoryInterface.php
fs c429ff43cd refactor: fix 7 CRUD system inconsistencies for robustness and maintainability
- Add user-assignment dependency check to DepartmentService.deleteByUuid (409 when users assigned)
- Standardize POST detection to isMethod('POST') in 10 create/edit actions
- Align RoleService code uniqueness to warning pattern (matching departments)
- Normalize repository create() return types from mixed to int|false (3 repos + 3 interfaces)
- Add JSON response branches to 4 non-user delete actions
- Document delete authorization ordering pattern
- Decompose AdminSettingsService.updateFromAdmin into domain-scoped private methods

Workflow: .agents/runs/CRUD-CONSISTENCY-001/
Reviewed by: Code Reviewer (pass), Security Reviewer (pass), Acceptance Tester (pass)
Quality gates: QG-001 PHPUnit pass, QG-002 PHPStan pass, QG-003 Architecture pass

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 18:25:33 +01:00

38 lines
1.1 KiB
PHP

<?php
namespace MintyPHP\Repository\Org;
/** Contract for department CRUD, existence checks, and filtered listing. */
interface DepartmentRepositoryInterface
{
public function list(): array;
public function listIds(): array;
public function listActiveIdsByTenantIds(array $tenantIds): array;
public function listByTenantIds(array $tenantIds): array;
public function listByIds(array $departmentIds, bool $includeInactive = false): array;
public function listPaged(array $options): array;
public function find(int $id): ?array;
public function findByUuid(string $uuid): ?array;
public function existsByCode(string $code, int $excludeId = 0): bool;
public function existsByTenantAndDescription(int $tenantId, string $description, int $excludeId = 0): bool;
public function countByTenantId(int $tenantId): int;
public function create(array $data): int|false;
public function update(int $id, array $data): bool;
public function setTenant(int $id, int $tenantId): bool;
public function delete(int $id): bool;
}