Skip to content

Commit 75300f8

Browse files
akoclaude
andcommitted
Document association ParentPointer/ChildPointer semantics in CLAUDE.md
Mendix uses counter-intuitive naming: ParentPointer = FROM entity (FK owner), ChildPointer = TO entity (referenced). This caused CE0066 when MemberAccess entries were added to the wrong side of an association. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a903ede commit 75300f8

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,23 @@ The MDL visitor (`buildDataType` in `visitor_helpers.go`) cannot distinguish bet
167167

168168
When generating Mendix expression strings (e.g., in `expressionToString()`), single quotes within string literals must be escaped by doubling them: `'it''s here'`. Do NOT use backslash escaping (`\'`). This matches Mendix Studio Pro's expression syntax.
169169

170+
### Association Parent/Child Pointer Semantics (Counter-Intuitive)
171+
172+
**CRITICAL**: Mendix BSON uses inverted naming for association pointers:
173+
174+
| BSON Field | Points To | MDL Keyword |
175+
|------------|-----------|-------------|
176+
| `ParentPointer` | **FROM** entity (FK owner) | `FROM Module.Child` |
177+
| `ChildPointer` | **TO** entity (referenced) | `TO Module.Parent` |
178+
179+
`CREATE ASSOCIATION Mod.Child_Parent FROM Mod.Child TO Mod.Parent` stores:
180+
- `ParentPointer = Child.$ID` (the FROM entity owns the foreign key)
181+
- `ChildPointer = Parent.$ID` (the TO entity is being referenced)
182+
183+
This affects **entity access rules**: MemberAccess entries for associations must only be added to the **FROM** entity (the one stored in `ParentPointer`). Adding them to the TO entity triggers CE0066 "Entity access is out of date".
184+
185+
The same convention applies in `domainmodel.Association`: `ParentID` = FROM entity, `ChildID` = TO entity.
186+
170187
### Public API Pattern
171188
```go
172189
// Read-only access

0 commit comments

Comments
 (0)