Copied!
Abstract
Methods
public __construct()
public addFind(array $parameters) : PHPFUI\ORM\DataObjectCursor
 
  • param array<string,mixed> $parameters
public addGroupBy(string $field, bool $rollup = false) : static
 

Add a valid group field

  • param bool $rollup can be applied to any group by field, but affects the entire group by clause
public addJoin(string $table, PHPFUI\ORM\Condition|string $on = '', string $type = 'LEFT', string $as = '') : static
 

Add a join with another table

  • param string $table name of the table to join, case sensitive
  • param string|\PHPFUI\ORM\Condition $on condition.
    • If $on is empty, then the following defaults are tried:
      • Join on the primary key of the join table if it exists on both tables
      • If field does not exist on both tables, then use the primary key of the main table
    • If $on is a non-empty string, use as the join field
    • Use \PHPFUI\ORM\Condition for complex joins
  • param string $type of join (LEFT, INNER, OUTER, RIGHT, FULL, CROSS)
public addOrderBy(string $field, string $ascending = 'ASC') : static
public addSelect(object|string $field, string $as = '') : static
 

Add a field the the select, must be a valid field

public addUnion(PHPFUI\ORM\Table $table, bool $any = false) : static
 

Add table for union.

  • param bool $any if true, adds all records from query, defaults to distinct records only
public static capitalSplit(string $key) : string
 

Split a string into words based on capital letters. Successive capital letters are considered an appreviation and grouped together.

public cleanField(string $fieldName) : string
public count() : int
 

Returns the count for the limited query.

public delete(bool $allowDeleteAll = false) : static
 

Delete record matching the requested parameters

public displayTransform(string $field, ?mixed $value = NULL) : ?mixed
 

transform any field or table.field from join

public find(array $parameters) : PHPFUI\ORM\DataObjectCursor
 
  • param array<string,mixed> $parameters
public static getAllTables(array $skipTables = []) : array
 

Get all tables in the application

  • param string[] $skipTables
  • return array<string,\PHPFUI\ORM\Table>
public getArrayCursor() : PHPFUI\ORM\ArrayCursor
 

Return a array collection matching the requested parameters

public getDataObjectCursor() : PHPFUI\ORM\DataObjectCursor
 

Return a object collection matching the requested parameters

public getExplainRows() : array
 

Return an array of the explain query

  • return array<string,mixed>[]
public getFields() : array
 
  • return array<string,array>
public getGroupBy() : string
 
  • return string the current group by string
public getHaving(array $input) : string
 

Return the string starting with "having" for the query

  • param array $input array reference. Current contents will remain, and new contents appended to the array
  • return string " HAVING condition"
public getHavingCondition() : PHPFUI\ORM\Condition
public getLastInput() : array
 
  • return array
public getLastSql() : string
public getLimit() : ?int
 
  • return ?int the current limit
public getLimitClause() : string
 
  • return string the current limit string
public getOffset() : ?int
public getOrderBy() : string
 
  • return string the current order by string
public getPage() : int
public getPrimaryKeys() : array
 
  • return string[]
public getRecord() : PHPFUI\ORM\Record
public getRecordCursor() : PHPFUI\ORM\RecordCursor
 

Return a Record collection matching the requested parameters

public getRows() : array
 
  • return array<string,string>[] records matching the requested parameters
public getSelectFields() : string
 
  • return string the current select string, '*' if nothing specified, or a comma delimited field list
public getSelectSQL(array $input, bool $limited = true) : string
 
  • param array $input Sets up lastSql and lastInput variable for use in returning cursors
public getTableName() : string
public getWhere(array $input) : string
 

Return the string starting with "where" for the query

  • param array $input array reference. Current contents will remain, and new contents appended to the array
  • return string " where condition"
public getWhereCondition() : PHPFUI\ORM\Condition
public insert(array $records, string $ignore = '') : bool
 

Mass insertion. Does not use a transaction, so surround by a transaction if needed

  • param \PHPFUI\ORM\Record[] $records
  • param string $ignore Pass "ignore" to not error on duplicate records
public insertOrIgnore(array $records) : bool
 

Inserts current data into table or ignores duplicate key if found

  • param \PHPFUI\ORM\Record[] $records
public setDistinct(string $distinct = 'DISTINCT') : static
public setFullJoinSelects(bool $fullSelects = true) : static
public setGroupBy(string $field, bool $rollup = false) : static
 

Reset to this group by field

  • param bool $rollup can be applied to any group by field, but affects the entire group by clause
public setHaving(?PHPFUI\ORM\Condition $condition = NULL) : static
public setLimit(int $limit = 20, ?int $page = NULL) : static
 
  • param int $page is zero based, so 0 is the first page, 1 is the second page
public setOffset(int $offset) : static
public setOrderBy(string $field, string $ascending = 'ASC') : static
public setSelectFields(string $clause) : static
 

Set user defined select fields.

public static setTranslationCallback(callable $callback) : void
public setWhere(?PHPFUI\ORM\Condition $condition = NULL) : static
public total() : int
 

Returns the total count for the unlimited query.

public translate(string $field = '') : string
 

Translate any valid field. $field must be a valid field, or empty to return the translated table name. Joined fields should be specified as table.field.

public update(array $variables) : static
 

Update all record matching the requested parameters with the variables passed

  • param array<string,mixed> $variables key => value array of variables to set
public updateFromTable(array $request) : bool
 
  • param array<string,mixed> $request
public validateFromTable(array $request) : array
 
  • param array<string,mixed> $request
  • return array<string,string> errors
Properties
protected static string $className = ''
protected string $distinct = ''
protected array $groupBys = []
 
  • var array<string,bool>
protected ?PHPFUI\ORM\Condition $havingCondition = NULL
protected PHPFUI\ORM\Record $instance
protected array $joins = []
 
  • var array<string,array>
protected array $lastInput = []
 
  • var array
protected string $lastSql = ''
protected ?int $limit = NULL
protected ?int $offset = NULL
protected array $orderBys = []
 
  • var array<string,string>
protected ?int $page = NULL
protected array $selects = []
 
  • var array<string,string>
protected array $unions = []
 
  • var array<string,array>
protected ?PHPFUI\ORM\Condition $whereCondition = NULL
Properties
private bool $fullJoinSelects = false
private static $translationCallback = NULL
 
  • var ?callable
Methods
private doTranslation(string $text) : string
private getCountSQL(array $input) : string
 
  • param array $input
private getJoins(array $input) : string
 
  • param array $input
private getTotalSQL(array $input) : string
 
  • param array $input
Properties
protected static string $className = ''
private static $translationCallback = NULL
 
  • var ?callable
Methods
public static capitalSplit(string $key) : string
 

Split a string into words based on capital letters. Successive capital letters are considered an appreviation and grouped together.

public static getAllTables(array $skipTables = []) : array
 

Get all tables in the application

  • param string[] $skipTables
  • return array<string,\PHPFUI\ORM\Table>
public static setTranslationCallback(callable $callback) : void
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration