LdapTools\Operation\QueryOperation::setScope PHP Method

setScope() public method

Set the scope for the LDAP query operation.
public setScope ( $scope )
$scope
    public function setScope($scope)
    {
        if (!in_array($scope, self::SCOPE)) {
            throw new LdapQueryException(sprintf('Scope type "%s" is invalid. See the QueryOperation::SCOPE[] constant for valid types.', $scope));
        }
        $this->properties['scope'] = $scope;
        return $this;
    }

Usage Example

 function it_should_NOT_enable_paging_when_executing_an_operation_that_disables_paging($pager)
 {
     $operation = new QueryOperation('(sAMAccountName=foo)', ['cn']);
     $operation->setUsePaging(false)->setBaseDn('example.local');
     $pager->setIsEnabled(false)->shouldBeCalled();
     $pager->start(null, 0)->shouldBeCalled();
     $pager->next()->shouldBeCalled();
     // Cannot simulate this without a connection. But the above control logic will be validated anyway.
     $this->shouldThrow('\\LdapTools\\Exception\\LdapConnectionException')->duringExecute($operation);
     $operation = new QueryOperation('(sAMAccountName=foo)', ['cn']);
     $operation->setScope(QueryOperation::SCOPE['BASE'])->setUsePaging(true)->setBaseDn('example.local');
     // Cannot simulate this without a connection. But the above control logic will be validated anyway.
     $this->shouldThrow('\\LdapTools\\Exception\\LdapConnectionException')->duringExecute($operation);
 }
All Usage Examples Of LdapTools\Operation\QueryOperation::setScope