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
ad6e9508
Commit
ad6e9508
authored
Sep 10, 2015
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed or removed todo's (if no longer relevant)
parent
d6104fc7
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
10 deletions
+30
-10
library/Solarium/Core/Client/Client.php
library/Solarium/Core/Client/Client.php
+20
-3
library/Solarium/Plugin/Loadbalancer/WeightedRandomChoice.php
...ary/Solarium/Plugin/Loadbalancer/WeightedRandomChoice.php
+0
-1
library/Solarium/QueryType/Select/Query/Component/FacetSet.php
...ry/Solarium/QueryType/Select/Query/Component/FacetSet.php
+0
-1
library/Solarium/QueryType/Select/Query/Component/Stats/Stats.php
...Solarium/QueryType/Select/Query/Component/Stats/Stats.php
+0
-1
library/Solarium/QueryType/Select/Query/Query.php
library/Solarium/QueryType/Select/Query/Query.php
+0
-1
tests/Solarium/Tests/Core/Client/ClientTest.php
tests/Solarium/Tests/Core/Client/ClientTest.php
+10
-3
No files found.
library/Solarium/Core/Client/Client.php
View file @
ad6e9508
...
@@ -217,6 +217,23 @@ class Client extends Configurable
...
@@ -217,6 +217,23 @@ class Client extends Configurable
*/
*/
protected
$adapter
;
protected
$adapter
;
/**
* Constructor.
*
* If options are passed they will be merged with {@link $options} using
* the {@link setOptions()} method.
*
* If an EventDispatcher instance is provided this will be used instead of creating a new instance
*
* @param array|\Zend_Config $options
* @param EventDispatcher $eventDispatcher
*/
public
function
__construct
(
$options
=
null
,
$eventDispatcher
=
null
)
{
$this
->
eventDispatcher
=
$eventDispatcher
;
parent
::
__construct
(
$options
);
}
/**
/**
* Create a endpoint instance.
* Create a endpoint instance.
*
*
...
@@ -276,7 +293,6 @@ class Client extends Configurable
...
@@ -276,7 +293,6 @@ class Client extends Configurable
}
}
//double add calls for the same endpoint are ignored, but non-unique keys cause an exception
//double add calls for the same endpoint are ignored, but non-unique keys cause an exception
//@todo add trigger_error with a notice for double add calls?
if
(
array_key_exists
(
$key
,
$this
->
endpoints
)
&&
$this
->
endpoints
[
$key
]
!==
$endpoint
)
{
if
(
array_key_exists
(
$key
,
$this
->
endpoints
)
&&
$this
->
endpoints
[
$key
]
!==
$endpoint
)
{
throw
new
InvalidArgumentException
(
'An endpoint must have a unique key'
);
throw
new
InvalidArgumentException
(
'An endpoint must have a unique key'
);
}
else
{
}
else
{
...
@@ -1144,8 +1160,9 @@ class Client extends Configurable
...
@@ -1144,8 +1160,9 @@ class Client extends Configurable
*/
*/
protected
function
init
()
protected
function
init
()
{
{
//@todo use injection
if
(
$this
->
eventDispatcher
===
null
)
{
$this
->
eventDispatcher
=
new
EventDispatcher
();
$this
->
eventDispatcher
=
new
EventDispatcher
();
}
foreach
(
$this
->
options
as
$name
=>
$value
)
{
foreach
(
$this
->
options
as
$name
=>
$value
)
{
switch
(
$name
)
{
switch
(
$name
)
{
...
...
library/Solarium/Plugin/Loadbalancer/WeightedRandomChoice.php
View file @
ad6e9508
...
@@ -110,7 +110,6 @@ class WeightedRandomChoice
...
@@ -110,7 +110,6 @@ class WeightedRandomChoice
}
}
// continue until a non-excluded value is found
// continue until a non-excluded value is found
// @todo optimize?
$result
=
null
;
$result
=
null
;
while
(
1
)
{
while
(
1
)
{
$result
=
$this
->
values
[
$this
->
getKey
()];
$result
=
$this
->
values
[
$this
->
getKey
()];
...
...
library/Solarium/QueryType/Select/Query/Component/FacetSet.php
View file @
ad6e9508
...
@@ -319,7 +319,6 @@ class FacetSet extends AbstractComponent
...
@@ -319,7 +319,6 @@ class FacetSet extends AbstractComponent
}
}
//double add calls for the same facet are ignored, but non-unique keys cause an exception
//double add calls for the same facet are ignored, but non-unique keys cause an exception
//@todo add trigger_error with a notice for double add calls?
if
(
array_key_exists
(
$key
,
$this
->
facets
)
&&
$this
->
facets
[
$key
]
!==
$facet
)
{
if
(
array_key_exists
(
$key
,
$this
->
facets
)
&&
$this
->
facets
[
$key
]
!==
$facet
)
{
throw
new
InvalidArgumentException
(
'A facet must have a unique key value within a query'
);
throw
new
InvalidArgumentException
(
'A facet must have a unique key value within a query'
);
}
else
{
}
else
{
...
...
library/Solarium/QueryType/Select/Query/Component/Stats/Stats.php
View file @
ad6e9508
...
@@ -152,7 +152,6 @@ class Stats extends AbstractComponent
...
@@ -152,7 +152,6 @@ class Stats extends AbstractComponent
}
}
//double add calls for the same field are ignored, but non-unique keys cause an exception
//double add calls for the same field are ignored, but non-unique keys cause an exception
//@todo add trigger_error with a notice for double add calls?
if
(
array_key_exists
(
$key
,
$this
->
fields
)
&&
$this
->
fields
[
$key
]
!==
$field
)
{
if
(
array_key_exists
(
$key
,
$this
->
fields
)
&&
$this
->
fields
[
$key
]
!==
$field
)
{
throw
new
InvalidArgumentException
(
'A field must have a unique key value'
);
throw
new
InvalidArgumentException
(
'A field must have a unique key value'
);
}
else
{
}
else
{
...
...
library/Solarium/QueryType/Select/Query/Query.php
View file @
ad6e9508
...
@@ -634,7 +634,6 @@ class Query extends BaseQuery
...
@@ -634,7 +634,6 @@ class Query extends BaseQuery
}
}
//double add calls for the same FQ are ignored, but non-unique keys cause an exception
//double add calls for the same FQ are ignored, but non-unique keys cause an exception
//@todo add trigger_error with a notice for double add calls?
if
(
array_key_exists
(
$key
,
$this
->
filterQueries
)
&&
$this
->
filterQueries
[
$key
]
!==
$filterQuery
)
{
if
(
array_key_exists
(
$key
,
$this
->
filterQueries
)
&&
$this
->
filterQueries
[
$key
]
!==
$filterQuery
)
{
throw
new
InvalidArgumentException
(
'A filterquery must have a unique key value within a query'
);
throw
new
InvalidArgumentException
(
'A filterquery must have a unique key value within a query'
);
}
else
{
}
else
{
...
...
tests/Solarium/Tests/Core/Client/ClientTest.php
View file @
ad6e9508
...
@@ -121,9 +121,16 @@ class ClientTest extends \PHPUnit_Framework_TestCase
...
@@ -121,9 +121,16 @@ class ClientTest extends \PHPUnit_Framework_TestCase
*/
*/
public
function
testGetEventDispatcher
()
{
public
function
testGetEventDispatcher
()
{
$this
->
assertInstanceOf
(
'\Symfony\Component\EventDispatcher\EventDispatcherInterface'
,
$this
->
client
->
getEventDispatcher
());
$this
->
assertInstanceOf
(
'\Symfony\Component\EventDispatcher\EventDispatcherInterface'
,
$this
->
client
->
getEventDispatcher
());
$event_dispatcher
=
$this
->
getMock
(
'\Symfony\Component\EventDispatcher\EventDispatcherInterface'
);
$eventDispatcher
=
$this
->
getMock
(
'\Symfony\Component\EventDispatcher\EventDispatcherInterface'
);
$this
->
client
->
setEventDispatcher
(
$event_dispatcher
);
$this
->
client
->
setEventDispatcher
(
$eventDispatcher
);
$this
->
assertSame
(
$event_dispatcher
,
$this
->
client
->
getEventDispatcher
());
$this
->
assertSame
(
$eventDispatcher
,
$this
->
client
->
getEventDispatcher
());
}
public
function
testEventDispatcherInjection
()
{
$eventDispatcher
=
$this
->
getMock
(
'\Symfony\Component\EventDispatcher\EventDispatcherInterface'
);
$client
=
new
Client
(
null
,
$eventDispatcher
);
$this
->
assertSame
(
$eventDispatcher
,
$client
->
getEventDispatcher
());
}
}
public
function
testConfigModeWithoutKeys
()
public
function
testConfigModeWithoutKeys
()
...
...
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