Skip to content

Commit 9e18df6

Browse files
committed
Add input format requirements for Ray.InputQuery to enforce flat key-value pairs
1 parent 94682f2 commit 9e18df6

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,40 @@ All query keys are normalized to camelCase:
102102
- `user-name``userName`
103103
- `UserName``userName`
104104

105+
### Input Format Requirements
106+
107+
Ray.InputQuery expects **flat key-value pairs** as input. Nested array structures are not supported:
108+
109+
```php
110+
// ✅ Correct - Flat structure
111+
$data = [
112+
'customerName' => 'John Doe',
113+
'customerEmail' => 'john@example.com',
114+
'shippingCity' => 'Tokyo'
115+
];
116+
117+
// ❌ Wrong - Nested arrays (e.g., from customer[name] form fields)
118+
$data = [
119+
'customer' => [
120+
'name' => 'John Doe',
121+
'email' => 'john@example.com'
122+
]
123+
];
124+
```
125+
126+
**Why this restriction?** When nested objects are flattened for database operations, all property names must be globally unique to avoid conflicts. This design ensures predictable parameter binding and prevents naming collisions.
127+
For HTML forms, use flat naming:
128+
129+
```html
130+
<!-- ✅ Correct -->
131+
<input name="customerName">
132+
<input name="customerEmail">
133+
134+
<!-- ❌ Avoid -->
135+
<input name="customer[name]">
136+
<input name="customer[email]">
137+
```
138+
105139
## Integration
106140

107141
Ray.InputQuery is designed as a foundation library to be used by:

0 commit comments

Comments
 (0)