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

ODM class should always supersede the type map

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.0.0-alpha1
    • Affects Version/s: 0.6.3
    • Component/s: None
    • Labels:
      None

      Currently, if php_phongo_bson_visit_binary() finds an ODM class (in our special binary field), it will supersede anything specified in the type map for the current document (be it "document" or "root", which may be introduced in PHPC-315).

      This means that users ultimately have no control over decoding a document if they would really like a stdClass or array returned (unless they project out the __pclass field).

      Per PR #21 for the serialization spec, we agreed that the ODM class should always take priority (as it might with unserialize() in PHP). Users for which this might be a problem would be encouraged to not used __pclass and instead implement their own mapping by specific fields paths in their documents, which we'll introduce in PHPC-314.

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: