getWheres() public method

Returns the wheres on the current builder.
public getWheres ( ) : array
return array
Beispiel #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;
 }
Beispiel #2
0
 /**
  * Returns the wheres on the current search object.
  *
  * @return array
  */
 public function getWheres()
 {
     return $this->query->getWheres();
 }
Beispiel #3
0
 /**
  * Assembles all where clauses in the current wheres property.
  *
  * @param Builder $builder
  * @param string  $query
  *
  * @return string
  */
 protected function compileWheres(Builder $builder, $query = '')
 {
     foreach ($builder->getWheres() as $where) {
         $query .= $this->compileWhere($where);
     }
     return $query;
 }