Copied!

Conditions are used for the WHERE part of the query. Think of each Condition as enclosed in parentheses ().

You start with an initial test: Field Operator Value (FOV) tupple.

You can then add additional FOV tupples with a logical operator (AND, OR, AND NOT, OR NOT) separating the previous FOV tupple.

To add a sub condition in parentheses, add another Condition with the same logical operator separator.

CloneableInstantiable
Methods
public __construct(?string $field = NULL, ?mixed $value = NULL, PHPFUI\ORM\Operator $operator = PHPFUI\ORM\Operator\Equal)
 

Start a Condition with a Field Operator Value (FOV) tupple.

Will try to parse FOV from string if $operator is null.

  • param ?string $field single name (no .) of a field existing the the table. Will try to parse FOV from string if $operator is null.
  • param mixed $value to test field against. Must be string for LIKE operators and an array for IN operators.
  • param \PHPFUI\ORM\Operator $operator comparision of your choice
public __toString() : string
 
  • return string of condition with values replaced by ? for PDO
public and(PHPFUI\ORM\Condition|string $condition, ?mixed $value = NULL, PHPFUI\ORM\Operator $operator = PHPFUI\ORM\Operator\Equal) : self
 

Add logical AND between FOV tupples or Condition

public andNot(PHPFUI\ORM\Condition|string $condition, ?mixed $value = NULL, PHPFUI\ORM\Operator $operator = PHPFUI\ORM\Operator\Equal) : self
 

Add logical AND NOT between FOV tupples or Condition

public count() : int
 
  • return int the number of FOV tupples in the condition
public getFields(?self $condition = NULL) : array
 
  • return string[] of all the fields used by the condition
public getInput() : array
 
  • return string[] of values that will match the ? returned in the condition string for PDO execution
public getJSON() : string
public or(PHPFUI\ORM\Condition|string $condition, ?mixed $value = NULL, PHPFUI\ORM\Operator $operator = PHPFUI\ORM\Operator\Equal) : self
 

Add logical OR between FOV tupples or Condition

public orNot(PHPFUI\ORM\Condition|string $condition, ?mixed $value = NULL, PHPFUI\ORM\Operator $operator = PHPFUI\ORM\Operator\Equal) : self
 

Add logical OR NOT between FOV tupples or Condition

Properties
private array $conditions = []
 
  • var array[] $conditions
Methods
private add(string $logical, PHPFUI\ORM\Condition|string $condition, PHPFUI\ORM\Operator $operator, ?mixed $value) : static
 

Internal method to type check $condition parameter

private getConditionArray(array $conditions) : array
 
  • param array[] $conditions
  • return array[]
© 2023 Bruce Wells
Search Namespaces \ Classes
Configuration