Skip to content

Conversation

@BackNot
Copy link
Collaborator

@BackNot BackNot commented Nov 18, 2025

Fix Doctrine ORM 3.x inverse-side DQL errors + correct One-to-One mapping

This PR updates all Assessment ↔ Project queries to be compatible with Doctrine ORM 3.x, which enforces stricter rules for association usage.

What was happening

After upgrading to Doctrine ORM 3, multiple queries began failing with:

A single-valued association path expression to an inverse side is not supported.
Instead of "assessment.project" use an explicit join.

This occurred because Assessment::$project is the inverse side of a One-To-One relationship, and Doctrine 3 forbids DQL path expressions on inverse associations.

What this PR changes
• Correctly defines the owning side (Project::$assessment) with an explicit JoinColumn
• Rewrites all DQL queries to join via the owning side:
• Replaced assessment.project joins with project.assessment
• Updated WHERE clauses accordingly
• Removes legacy inverse-side traversal that was silently allowed in ORM 2.x but invalid in ORM 3.x

Why this is needed

Doctrine ORM 3 removed several implicit behaviors and now requires association paths to reference the owning side.
These fixes:
• Prevent runtime template errors during rendering
• Ensure future queries function consistently
• Bring our mapping and DQL usage in line with Doctrine 3’s stricter requirements
• Makes the entity relationship definition explicit and correct

Testing
• All updated queries were tested manually against existing data
• Confirmed that lazy-loading works normally through the owning side

Result

The codebase is now fully compatible with Doctrine ORM 3.x and avoids all inverse-side DQL issues.

… mapping and rewriting DQL joins to use the owning side.
@BackNot BackNot merged commit 4b5ae3d into OWASP:main Nov 18, 2025
1 check passed
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