Skip to content

Commit f65c9a8

Browse files
author
Manus AI
committed
Remove module-specific references from core reporting framework
- Generalized examples in comments from specific use cases to generic relationship patterns - Changed 'asset.financials.monthly_hire_revenue' to 'relationship.nested.column' - Removed specific table alias examples - Maintains separation between core framework and commercial modules - No functional changes, only documentation/comment updates
1 parent d35b0b0 commit f65c9a8

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

src/Support/Reporting/ReportQueryConverter.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -406,24 +406,22 @@ protected function resolveAliasAndColumn(string $rootTable, string $columnPath):
406406
return [$rootTable, $parts[0]];
407407
}
408408

409-
$col = array_pop($parts); // The final column name (e.g., "monthly_hire_revenue")
409+
$col = array_pop($parts); // The final column name
410410

411411
// Build the relationship path step by step to find the correct alias
412-
// For "asset.financials.monthly_hire_revenue", we need to check:
413-
// 1. "asset.financials" (full path)
414-
// 2. If not found, build it from "asset" + "financials"
412+
// For nested relationships like "relationship.nested.column", we need to:
413+
// 1. Check for the full path "relationship.nested"
414+
// 2. If not found, resolve step by step from "relationship" to "nested"
415415

416-
$relPath = implode('.', $parts); // e.g., "asset.financials"
416+
$relPath = implode('.', $parts);
417417

418418
// Check if we have a direct alias for the full relationship path
419419
if (isset($this->joinAliases[$relPath])) {
420420
return [$this->joinAliases[$relPath], $col];
421421
}
422422

423423
// If not, try to resolve it step by step
424-
// For "asset.financials", we need to:
425-
// 1. Get the alias for "asset" (e.g., "fliit_asset_allocations_asset")
426-
// 2. Then look for "asset.financials" alias
424+
// Walk through each segment and use the longest matching path
427425

428426
$currentTable = $rootTable;
429427
$pathSegments = [];
@@ -1179,8 +1177,8 @@ protected function validateQueryConfig(): void
11791177
/**
11801178
* Extract relationship paths from a computed column expression.
11811179
*
1182-
* This method parses the expression to find column references like "asset.financials.monthly_hire_revenue"
1183-
* and returns the relationship paths (e.g., "asset.financials").
1180+
* This method parses the expression to find column references with nested relationships
1181+
* and returns the relationship paths (e.g., "relationship.nested").
11841182
*
11851183
* @param string $expression The computed column expression
11861184
* @param string $rootTable The root table name (not used currently but kept for consistency)
@@ -1213,7 +1211,7 @@ protected function extractRelationshipPathsFromExpression(string $expression, st
12131211
$depth++;
12141212
}
12151213

1216-
// Now extract all column references that look like relationship paths (e.g., "asset.financials.monthly_hire_revenue")
1214+
// Now extract all column references that look like relationship paths
12171215
// We need to match patterns like: word.word.word (but not inside string literals)
12181216

12191217
// First, remove string literals to avoid matching inside them
@@ -1245,7 +1243,7 @@ protected function extractRelationshipPathsFromExpression(string $expression, st
12451243
/**
12461244
* Extract relationship paths from a computed column expression and create necessary joins.
12471245
*
1248-
* This method parses the expression to find column references like "asset.financials.monthly_hire_revenue"
1246+
* This method parses the expression to find column references with nested relationships
12491247
* and ensures that all necessary auto-joins are created for the relationship paths.
12501248
*
12511249
* @deprecated This method is now redundant as join creation happens in processAutoJoins

0 commit comments

Comments
 (0)