Example #1
0
 /**
  * Searches for entries in the directory
  *
  * @param int     $scope      Search scope (ALL, ONE or BASE)
  * @param string  $baseDn     Base distinguished name to look below
  * @param string  $filter     Filter for the search
  * @param array   $attributes Names of attributes to retrieve (Default: All)
  * @param int     $pageSize   Page size (Default: 0, no paging)
  * @param bool    $eagerLoad  Set to true to load all entries into the
  *                            search result, false to load on demand as each
  *                            page is exhausted (Default: true)
  *
  * @return SearchInterface Search result set
  *
  * @throws NoResultException if no result can be retrieved
  * @throws SizeLimitException if size limit got exceeded
  * @throws MalformedFilterException if filter is wrongly formatted
  * @throws SearchException if search failed otherwise
  */
 public function search($scope, $baseDn, $filter, $attributes = null, $pageSize = 0, $eagerLoad = true)
 {
     $this->processSearchFailure();
     $search = new Search();
     $search->setBaseDn($baseDn);
     $search->setFilter($filter);
     $search->setAttributes($attributes);
     $search->setScope($scope);
     $search->setEntries($this->shiftResults());
     $this->logSearch($search);
     return $search;
 }