Return query result as object instead of array for laravel/database compatibility

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Unknown
    • 5.0.0
    • Affects Version/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Laravel’s Query Builder always returns objects (source).

      - ['typeMap' => ['root' => 'array', 'document' => 'array']]
      + ['typeMap' => ['root' => 'object', 'document' => 'array']]
      

      This is a major breaking change that requires changing all array access into property access. Returning a MongoDB\Model\BSONDocument and MongoDB\Model\BSONArray is not possible as the data is casted with native PHP cast feature in Laravel code: (object) $result and (array) $result.

              Assignee:
              Jérôme Tamarelle
              Reporter:
              Jérôme Tamarelle
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: