Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-php-library
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sinan
mongo-php-library
Commits
7406234b
Unverified
Commit
7406234b
authored
Aug 01, 2019
by
Andreas Braun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPLIB-242: Refactor Aggregate to use field path syntax in type map
parent
b8c159da
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
Aggregate.php
src/Operation/Aggregate.php
+4
-5
No files found.
src/Operation/Aggregate.php
View file @
7406234b
...
@@ -27,7 +27,6 @@ use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
...
@@ -27,7 +27,6 @@ use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnexpectedValueException
;
use
MongoDB\Exception\UnexpectedValueException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Model\TypeMapArrayIterator
;
use
ArrayIterator
;
use
ArrayIterator
;
use
stdClass
;
use
stdClass
;
use
Traversable
;
use
Traversable
;
...
@@ -280,16 +279,16 @@ class Aggregate implements Executable
...
@@ -280,16 +279,16 @@ class Aggregate implements Executable
return
$cursor
;
return
$cursor
;
}
}
if
(
isset
(
$this
->
options
[
'typeMap'
]))
{
$cursor
->
setTypeMap
(
\MongoDB\create_field_path_type_map
(
$this
->
options
[
'typeMap'
],
'result.$'
));
}
$result
=
current
(
$cursor
->
toArray
());
$result
=
current
(
$cursor
->
toArray
());
if
(
!
isset
(
$result
->
result
)
||
!
is_array
(
$result
->
result
))
{
if
(
!
isset
(
$result
->
result
)
||
!
is_array
(
$result
->
result
))
{
throw
new
UnexpectedValueException
(
'aggregate command did not return a "result" array'
);
throw
new
UnexpectedValueException
(
'aggregate command did not return a "result" array'
);
}
}
if
(
isset
(
$this
->
options
[
'typeMap'
]))
{
return
new
TypeMapArrayIterator
(
$result
->
result
,
$this
->
options
[
'typeMap'
]);
}
return
new
ArrayIterator
(
$result
->
result
);
return
new
ArrayIterator
(
$result
->
result
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment