Skip to content

Commit

Permalink
Merge pull request #31 from designmynight/strings-not-callable
Browse files Browse the repository at this point in the history
fix: don't treat strings as callables
  • Loading branch information
Will Taylor-Jackson authored Feb 2, 2018
2 parents 00ff1b0 + 68dfcd4 commit 5a09bfe
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/DesignMyNight/Elasticsearch/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function whereNestedDoc($column, $query, $boolean = 'and'): self
{
$type = 'NestedDoc';

if ( is_callable($query) ){
if (!is_string($query) && is_callable($query)){
call_user_func($query, $query = $this->newQuery());
}

Expand Down Expand Up @@ -192,7 +192,7 @@ public function whereWithOptions(...$args): self
/**
* Add a filter query by calling the required 'where' method
* and capturing the added where as a filter
*
*
* @param string $method
* @param array $args
* @return self
Expand Down Expand Up @@ -315,11 +315,11 @@ protected function whereRelationship(string $relationshipType, string $documentT
*/
public function aggregation($key, $type, $args = null, $aggregations = null): self
{
if ( is_callable($args) ){
if (!is_string($args) && is_callable($args)){
call_user_func($args, $args = $this->newQuery());
}

if ( is_callable($aggregations) ){
if (!is_string($aggregations) && is_callable($aggregations)){
call_user_func($aggregations, $aggregations = $this->newQuery());
}

Expand Down Expand Up @@ -351,7 +351,7 @@ public function orderBy($column, $direction = 1, $options = null): self

/**
* Whether to include inner hits in the response
*
*
* @return self
*/
public function withInnerHits(): self
Expand All @@ -363,7 +363,7 @@ public function withInnerHits(): self

/**
* Get the aggregations returned from query
*
*
* @return array
*/
public function getAggregationResults(): array
Expand Down

0 comments on commit 5a09bfe

Please sign in to comment.