Skip to content

feat: add ConditionResolver, test suite, and CI#3

Merged
oojacoboo merged 2 commits into
masterfrom
feature/condition-resolver-and-tests
Apr 15, 2026
Merged

feat: add ConditionResolver, test suite, and CI#3
oojacoboo merged 2 commits into
masterfrom
feature/condition-resolver-and-tests

Conversation

@oojacoboo

@oojacoboo oojacoboo commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • ConditionResolver: Standalone class that resolves multi-tenancy SQL conditions from #[MultiTenancy] entity attributes without requiring Doctrine's DQL/SQLFilter lifecycle. Enables raw SQL repository queries to reuse the same tenant-scoping logic.
  • Filter refactor: Filter::addFilterConstraint() now delegates to ConditionResolver, keeping the SQLFilter as a thin adapter.
  • PHPUnit test suite: 40 tests / 60 assertions covering all classes — ConditionResolver, Filter, Listener, and all attribute classes.
  • GitHub Actions CI: PHP 8.2/8.3/8.4 matrix running on push and PR to master.
  • Makefile: Standard recipes (make test, make init, etc.)

Usage (ConditionResolver)

$resolver = new ConditionResolver($listener);
$condition = $resolver->resolve(WorkOrder::class, 'wo');
// Returns: "wo.company_id = 42 AND wo.unit_id IN(SELECT ...)"

Test plan

  • make test passes locally (40/40 tests, 60 assertions)
  • CI workflow runs on all 3 PHP versions (8.2, 8.3, 8.4)

Extract SQL generation logic from Filter (Doctrine SQLFilter) into a
standalone ConditionResolver class that can resolve multi-tenancy
conditions for any entity class without requiring DQL or ClassMetadata.
This enables raw SQL repository queries to reuse the same tenant-scoping
logic defined in #[MultiTenancy] attributes.

- Add ConditionResolver with resolve(entityClass, tableAlias) method
- Refactor Filter to delegate to ConditionResolver
- Add comprehensive PHPUnit 11 test suite (40 tests, 60 assertions)
- Add GitHub Actions CI workflow (PHP 8.2/8.3/8.4 matrix)
- Add Makefile with standard recipes
@oojacoboo
oojacoboo merged commit 9cfafa8 into master Apr 15, 2026
3 checks passed
@oojacoboo
oojacoboo deleted the feature/condition-resolver-and-tests branch April 15, 2026 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant