Adldap\Query\Builder::getOrWheres PHP Method

getOrWheres() public method

Returns the or wheres on the current builder.
public getOrWheres ( ) : array
return array
    public function getOrWheres()
    {
        return $this->bindings['orWhere'];
    }

Usage Example

Example #1
0
 /**
  * Compiles the Builder instance into an LDAP query string.
  *
  * @param \Adldap\Query\Builder $builder
  *
  * @return string
  */
 public function compileQuery(Builder $builder)
 {
     // Retrieve the query 'where' bindings.
     $wheres = $builder->getWheres();
     // Retrieve the query 'orWhere' bindings.
     $orWheres = $builder->getOrWheres();
     // Retrieve the query filter bindings.
     $filters = $builder->getFilters();
     // We'll combine all raw filters together first.
     $query = implode(null, $filters);
     // Compile wheres.
     $query = $this->compileWheres($wheres, $query);
     // Compile or wheres.
     $query = $this->compileOrWheres($orWheres, $query);
     // Count the total amount of filters.
     $total = count($wheres) + count($filters);
     // Make sure we wrap the query in an 'and' if using
     // multiple filters. We also need to check if only
     // one where is used with multiple orWheres, that
     // we wrap it in an `and` query.
     if ($total > 1 || count($wheres) === 1 && count($orWheres) > 0) {
         $query = $this->compileAnd($query);
     }
     return $query;
 }
All Usage Examples Of Adldap\Query\Builder::getOrWheres