DAO for dual SQL table
| package | salt\dao |
|---|---|
| inherited_from | \salt\Base |
COLUMN(mixed $format = NULL) : \salt\DAOConverter
mixed(Optional, NULL) the format to use
\salt\DAOConverterConverter for display the column of fieldFORM(mixed $format = NULL) : \salt\DAOConverter
mixed(Optional, NULL) format to use
\salt\DAOConverterConverter for display the input of a fieldMODEL(boolean $withLoad = TRUE) : \salt\Model
boolean(Optionnal, TRUE) if TRUE, initialize the model if not exists. Never use in normal usage, only for internal usage
\salt\Modelthe Model objectSQL(mixed $format = NULL) : \salt\DAOConverter
mixed(Optional, NULL) format to use
\salt\DAOConverterConverter for retrieve SQL field valueVIEW(mixed $format = NULL) : \salt\DAOConverter
mixed(Optional, NULL) format to use
\salt\DAOConverterConverter for display the value of field__construct()
Have to be called by child classes for having an internal ID
__get(string $fieldName) : mixed
Can also return an _InternalFieldAccess if $fieldName is FORM or VIEW
string
mixedthe value of the field__set(string $fieldName, mixed $value)
stringthe field to change
mixedthe value
addExtraField(string $extraField)
stringfield name
\salt\SaltException |
if field name is a regular field |
|---|
checkNotState(integer|array<mixed,integer> $state, string $message = NULL)
integerarray<mixed,integer>forbidden states for the object
stringerror message for exception
\salt\SaltException |
if the object is in one of the forbidden states |
|---|
checkState(integer|array<mixed,integer> $state)
integerarray<mixed,integer>expected states for the object
\salt\SaltException |
if the object is not in one of the expected states |
|---|
deleteQuery() : \salt\DeleteQuery
\salt\DeleteQuerythe delete querygetById(\salt\DBHelper $db, mixed $id) : static | NULL
\salt\DBHelperThe database to search object
mixeda value of the id field
staticNULLthe first object with this id. All fields are loaded. Return NULL if no object foundgetByIds(\salt\DBHelper $DB, array<mixed,mixed> $ids) : array<mixed,static>
\salt\DBHelperdatabase to search objects
array<mixed,mixed>list of value to search
array<mixed,static>associative array : id => objectgetField(string $fieldName, boolean $createIfNotExists = FALSE) : \salt\Field
stringfield name registered with metadata() or extra field constructor parameter
booleanif TRUE, create extra field if not exists, throw SaltException otherwise
\salt\FieldgetId() : mixed
mixedvalue of id fieldgetIdField() : string
stringfield namegetInternalId() : integer
integerUnique ID of an instancegetModifiedFields() : array<mixed,mixed>
array<mixed,mixed>fieldName => valuegetNew(array<mixed,string> $extraFields = NULL) : static
array<mixed,string>array of fieldName to add to the instance
staticgetTableName(boolean $withEscape = TRUE) : string
boolean(Optional, TRUE) FALSE for do not escape table name with backquotes
stringthe table nameinitAfterCreateTable(\salt\DBHelper $db) : array<mixed,static>
\salt\DBHelperdatabase where table is created
array<mixed,static>objects to create in tableisDeleted() : boolean
booleanTRUE if the object have been deletedisLoaded() : boolean
booleanTRUE if the object have been loaded for a database by PDOisModified() : boolean
booleanTRUE if the object have been modifiedisNew() : boolean
booleanTRUE if the object have been created with a new ...()isReadonly() : boolean
booleanTRUE if the object is readonly (Base::singleton() is a readonly object)query(string $withField = FALSE) : \salt\Query
stringTRUE for retrieve all fields, FALSE otherwise
\salt\Querythe empty query objectreadonly()
singleton() : static
statica singleton instance of the objectupdateQuery(\salt\Query $fromQuery = NULL) : \salt\UpdateQuery
\salt\Querythe query to use for update
\salt\UpdateQuerythe update querycheckFieldExists(string $fieldName, boolean $forValue= FALSE, boolean $doNotThrowException= FALSE) : boolean
string
booleanalso check field is loaded and value can be retrieve
booleanreturn FALSE if field does not exists instead of throwing exception
\salt\SaltException |
if field don't exists or is not loaded (if $forValue) |
|---|
booleanTRUE if field existsinitValues(array<mixed,string> $loadedFields= NULL, array<mixed,string> $extraFields= NULL, boolean $loadAsNew= FALSE)
array<mixed,string>fields loaded by a query for this object
array<mixed,string>fields to add to new instance only
booleanif TRUE, the afterLoad() method set the state to NEW instead of LOADED
$_saltExtraFields : array<mixed,mixed>
array()| content | array of extraFieldName => value |
|---|
$_saltExtraFieldsMetadata : array<mixed,\salt\Field>
array()| content | array of extraFieldName => Field |
|---|
$_saltFromQueryAPI : boolean
FALSE$_saltLoadValues : array<mixed,mixed>
array()| content | array of fieldName => value |
|---|
$_saltModels : \salt\Model
NULL$_saltSingletons : \salt\Base
array()$_saltState : integer
self::_SALT_STATE_NONE$_saltValues : array<mixed,mixed>
array()| content | array of fieldName => value |
|---|
$_salt_id : integer
$_salt_id_sequence : integer
0_SALT_STATE_DELETED = 40
_SALT_STATE_DYNAMIC_LOADING = 13
_SALT_STATE_LOADED = 20
_SALT_STATE_LOADING = 12
_SALT_STATE_MODIFIED = 30
_SALT_STATE_NEW = 10
_SALT_STATE_NEW_LOADING = 11
_SALT_STATE_NONE = 0
_SALT_STATE_READONLY = 50