Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
solarium
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
solarium
Commits
3d2e8828
Commit
3d2e8828
authored
Nov 25, 2014
by
Douglas Greenshields
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
only check type for added documents to add query if provided as an array
parent
a9d8a52b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
library/Solarium/QueryType/Update/Query/Command/Add.php
library/Solarium/QueryType/Update/Query/Command/Add.php
+6
-3
No files found.
library/Solarium/QueryType/Update/Query/Command/Add.php
View file @
3d2e8828
...
@@ -89,9 +89,12 @@ class Add extends Command
...
@@ -89,9 +89,12 @@ class Add extends Command
*/
*/
public
function
addDocuments
(
$documents
)
public
function
addDocuments
(
$documents
)
{
{
foreach
(
$documents
as
$document
)
{
//only check documents for type if in an array (iterating a Traversable may do unnecessary work)
if
(
!
(
$document
instanceof
DocumentInterface
))
{
if
(
is_array
(
$documents
))
{
throw
new
RuntimeException
(
'Documents must implement DocumentInterface.'
);
foreach
(
$documents
as
$document
)
{
if
(
!
(
$document
instanceof
DocumentInterface
))
{
throw
new
RuntimeException
(
'Documents must implement DocumentInterface.'
);
}
}
}
}
}
...
...
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