Elastica\Query\HasChild::setScope PHP Method

setScope() public method

Sets the scope.
public setScope ( string $scope )
$scope string Scope
    public function setScope($scope)
    {
        return $this->setParam('_scope', $scope);
    }

Usage Example

 /**
  * @group unit
  */
 public function testSetScope()
 {
     $q = new MatchAll();
     $type = 'test';
     $scope = 'foo';
     $query = new HasChild($q, $type);
     $query->setScope($scope);
     $expectedArray = array('has_child' => array('query' => $q->toArray(), 'type' => $type, '_scope' => $scope));
     $this->assertEquals($expectedArray, $query->toArray());
 }