Copied!

Autogenerated. Do not modify. Modify SQL table, then run oneOffScripts\generateCRUD.php table_name

  • property int $migrationId MySQL type int(11)
  • property \PHPFUI\ORM\Record\Migration $migration related record
  • property string $ran MySQL type timestamp
Abstract
Constants
public PHPFUI\ORM\Record::ALLOWS_NULL_INDEX = 3
public PHPFUI\ORM\Record::DEFAULT_INDEX = 4
public PHPFUI\ORM\Record::LENGTH_INDEX = 2
public PHPFUI\ORM\Record::MYSQL_TYPE_INDEX = 0
public PHPFUI\ORM\Record::PHP_TYPE_INDEX = 1
Methods
public PHPFUI\ORM\Record::__construct(PHPFUI\ORM\DataObject|array|string|int|?null $parameter = NULL)
 

Construct a CRUD object

Reads from the database based on the parameters passed to the constructor. No parameters creates an empty object.

Possible $parameter types and values
  • int primary key value, will load object values if the primary key value exists
  • string primary key value, will load object values if the primary key value exists
  • array record is attempted to be read from database using the values of the fields provided.
  • \PHPFUI\ORM\DataObject record is constructed from an existing DataObject
  • null (default) constructs an empty object
  • param int|array<string,mixed>|null|string $parameter
public PHPFUI\ORM\Record::__get(string $field) : ?mixed
 

Allows for $object->field syntax

Unset fields will return null

public PHPFUI\ORM\Record::__isset(string $field) : bool
 

Allows for empty($object->field) to work correctly

public PHPFUI\ORM\Record::__set(string $field, ?mixed $value) : void
public static PHPFUI\ORM\Record::addDisplayTransform(string $field, callable $callback) : void
 

Add a transform for get. Callback is passed value.

public PHPFUI\ORM\Record::addSetTransform(string $field, callable $callback) : static
 

Add a transform for set. Callback is passed value.

public PHPFUI\ORM\Record::blankDate(?string $date) : string
public PHPFUI\ORM\Record::clean() : static
 

clean is called before insert or update. Override to impliment cleaning on a specific record

public PHPFUI\ORM\Record::create() : int
 

Alias of insert

public PHPFUI\ORM\Record::delete() : bool
 

Deletes the record (and children) currently pointed to by the data

  • return bool true if record deleted
public PHPFUI\ORM\Record::displayTransform(string $field, ?mixed $value = NULL) : ?mixed
 

Transform a field for display

public PHPFUI\ORM\Record::empty() : bool
 
  • return bool true if empty (default values)
public PHPFUI\ORM\Record::getAutoIncrement() : bool
 
  • return bool true if table has an auto increment primary key
public static PHPFUI\ORM\Record::getFields() : array
 
  • return array<string,array> of fields properties indexed by field name
public PHPFUI\ORM\Record::getLength(string $field) : int
 
  • return int Maximium valid field length
public static PHPFUI\ORM\Record::getPrimaryKeys() : array
 
  • return string[] primary keys
public PHPFUI\ORM\Record::getPrimaryKeyValues() : array
 
  • return array<string,string> indexed by primary keys containing the key value
public static PHPFUI\ORM\Record::getTableName() : string
 
  • return string table name, case sensitive
public static PHPFUI\ORM\Record::getVirtualFields() : array
 

Get the virtual field names

  • return string[]
public PHPFUI\ORM\Record::insert() : int|bool
 

Inserts current data into table

  • return int|bool inserted id if auto increment, true on insertion if not auto increment or false on error
public PHPFUI\ORM\Record::insertOrIgnore() : int|bool
 

Inserts current data into table or ignores duplicate key if found

  • return int|bool inserted id if auto increment, true on insertion if not auto increment or false on error
public PHPFUI\ORM\Record::insertOrUpdate() : int|bool
 

Inserts current data into table or updates if duplicate key

  • return int|bool inserted id if auto increment, true on insertion if not auto increment or false on error
public PHPFUI\ORM\DataObject::isset(string $field) : bool
public PHPFUI\ORM\Record::loaded() : bool
 
  • return bool true if loaded from the disk
public PHPFUI\ORM\Record::loadFromSQL(string $sql, array $input = []) : bool
 

Load first from SQL query

  • param array $input
public PHPFUI\ORM\DataObject::offsetExists( $offset) : bool
public PHPFUI\ORM\Record::offsetGet( $offset) : ?mixed
 

Low level get access to underlying data to implement ArrayAccess

public PHPFUI\ORM\Record::offsetSet( $offset, $value) : void
 

Low level set access to underlying data to implement ArrayAccess

public PHPFUI\ORM\DataObject::offsetUnset( $offset) : void
public PHPFUI\ORM\Record::read(array|string|int $fields) : bool
 

Read a record from the db. If more than one match, only the first is loaded.

  • param array<string,mixed>|int|string $fields if int|string, primary key, otherwise a key => value array to match on. Multiple field value pairs are anded into the where clause.
  • return bool true if a record found
public PHPFUI\ORM\Record::reload() : bool
 

Reload the object from the database. Unsaved fields are discarded.

public PHPFUI\ORM\Record::save() : int|bool
 

Save the record, will either update if it exists or insert if not

public PHPFUI\ORM\Record::setCustomValidator(string $className) : static
 

Set a custom validator class

public PHPFUI\ORM\Record::setEmpty() : static
 

Sets all fields to default values

public PHPFUI\ORM\Record::setFrom(array $values, bool $loaded = false) : static
 

Sets the object to values in the array. Invalid array values are ignored.

  • param array<string,mixed> $values
  • param bool $loaded set to true if you want to simulated being loaded from the db.
public PHPFUI\ORM\DataObject::toArray() : array
 
  • return array<string,mixed>
public PHPFUI\ORM\Record::update() : bool
 

Update the database with the current record based on table primary key

public PHPFUI\ORM\Record::validate(string $optionalMethod = '', ?self $originalRecord = NULL) : array
 
  • return array<string,string[]> validation errors indexed by offending field containing an array of translated errors
Properties
protected static bool $autoIncrement = false
protected array PHPFUI\ORM\DataObject::$current
protected static bool PHPFUI\ORM\Record::$deleteChildren = true
protected static array PHPFUI\ORM\Record::$displayTransforms = []
 
  • var array<string,callable[]>
protected bool PHPFUI\ORM\Record::$empty = true
protected static array $fields = ['migrationId' => ['int(11)', 'int', 11, false, NULL], 'ran' => ['timestamp', 'string', 20, false, NULL]]
 
  • var array<string,array>
protected bool PHPFUI\ORM\Record::$loaded = false
protected static array $primaryKeys = ['migrationId']
 
  • var string[]
protected static array PHPFUI\ORM\Record::$setTransforms = []
 
  • var array<string,callable[]>
protected static string $table = 'migration'
protected string PHPFUI\ORM\Record::$validator = ''
protected static array PHPFUI\ORM\Record::$virtualFields = []
 
  • var array<string,string[]>
Methods
protected PHPFUI\ORM\Record::cleanEmail(string $field) : static
 

Lowercases and strips invalid email characters. Does not validate email address.

protected PHPFUI\ORM\Record::cleanFloat(string $field, int $decimalPoints = 2) : static
 

removes all non-digits (0-9, . and -)

protected PHPFUI\ORM\Record::cleanLowerCase(string $field) : static
 

Converts the field to all lower case

protected PHPFUI\ORM\Record::cleanNumber(string $field) : static
 

removes all non-digits (0-9 and -) from string representation of a number

protected PHPFUI\ORM\Record::cleanPhone(string $field, string $regExSeparators = '\-\. ') : static
 

removes all invalid characters. (0-9) and regex separators are valid.

protected PHPFUI\ORM\Record::cleanProperName(string $field) : static
 

Properly capitalizes proper names if in single case. Mixed case strings are not altered.

protected PHPFUI\ORM\Record::cleanUpperCase(string $field) : static
 

Converts the field to all upper case

protected PHPFUI\ORM\Record::timeStamp(?int $timeStamp) : string
Properties
protected static bool $autoIncrement = false
protected static bool PHPFUI\ORM\Record::$deleteChildren = true
protected static array PHPFUI\ORM\Record::$displayTransforms = []
 
  • var array<string,callable[]>
protected static array $fields = ['migrationId' => ['int(11)', 'int', 11, false, NULL], 'ran' => ['timestamp', 'string', 20, false, NULL]]
 
  • var array<string,array>
protected static array $primaryKeys = ['migrationId']
 
  • var string[]
protected static array PHPFUI\ORM\Record::$setTransforms = []
 
  • var array<string,callable[]>
protected static string $table = 'migration'
protected static array PHPFUI\ORM\Record::$virtualFields = []
 
  • var array<string,string[]>
Methods
public static PHPFUI\ORM\Record::addDisplayTransform(string $field, callable $callback) : void
 

Add a transform for get. Callback is passed value.

public static PHPFUI\ORM\Record::getFields() : array
 
  • return array<string,array> of fields properties indexed by field name
public static PHPFUI\ORM\Record::getPrimaryKeys() : array
 
  • return string[] primary keys
public static PHPFUI\ORM\Record::getTableName() : string
 
  • return string table name, case sensitive
public static PHPFUI\ORM\Record::getVirtualFields() : array
 

Get the virtual field names

  • return string[]
© 2025 Bruce Wells
Search Namespaces \ Classes
Configuration