Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-mongodb
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
laravel-mongodb
Commits
f0b91050
Commit
f0b91050
authored
Aug 09, 2014
by
Jens Segers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak raw()
parent
a042c166
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
16 deletions
+2
-16
Builder.php
src/Jenssegers/Mongodb/Eloquent/Builder.php
+2
-16
No files found.
src/Jenssegers/Mongodb/Eloquent/Builder.php
View file @
f0b91050
...
...
@@ -215,26 +215,12 @@ class Builder extends EloquentBuilder {
// Get raw results from the query builder.
$results
=
$this
->
query
->
raw
(
$expression
);
$connection
=
$this
->
model
->
getConnectionName
();
// Convert MongoCursor results to a collection of models.
if
(
$results
instanceof
MongoCursor
)
{
$results
=
iterator_to_array
(
$results
,
false
);
$models
=
array
();
// Once we have the results, we can spin through them and instantiate a fresh
// model instance for each records we retrieved from the database. We will
// also set the proper connection name for the model after we create it.
foreach
(
$results
as
$result
)
{
$models
[]
=
$model
=
$this
->
model
->
newFromBuilder
(
$result
);
$model
->
setConnection
(
$connection
);
}
return
$this
->
model
->
newCollection
(
$models
);
return
$this
->
model
->
hydrate
(
$results
);
}
// The result is a single object.
...
...
@@ -242,7 +228,7 @@ class Builder extends EloquentBuilder {
{
$model
=
$this
->
model
->
newFromBuilder
(
$results
);
$model
->
setConnection
(
$
connection
);
$model
->
setConnection
(
$
this
->
model
->
getConnection
()
);
return
$model
;
}
...
...
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