Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-1154

Implement wild card syntax for typemap field paths

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      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.

            Assignee:
            derick Derick Rethans
            Reporter:
            derick Derick Rethans
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: