-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
Implement an extension to the typemap system by allowing wild card field paths which contain a BSON array or BSON document to be converted to an array, stdClass, or object of a specific type.
This adds the "$" syntax to the "fieldPath" field to the TypeMap options as follows:
[ ‘root’ => (object|array|classname), ‘document’ => (object|array|classname), ‘array’ => (object|array|classname), // overrides defaults but not __pclass (“fieldPaths” name may change) ‘fieldPaths’ => [ ‘Object’ => (object|array|classname), ‘Object.bob’ => …, ‘Object.jim.0’ => …, ‘Object.jim.1’ => …, ‘Object.jim.$’ => …, ‘Object.$’ => …, ], ];
The order of the entries in the fieldPaths matters. The first "match" for each field path will be used. So for "Object.jim.1", the specific entry is used, but for "Object.jim.4", the entry associated with "Object.jim.$" will be used.
- depends on
-
PHPC-314 Implement type map syntax for documents within field paths
- Closed