Base class for all business DAO objects
package | salt\dao |
---|---|
inherited_from | \salt\Identifiable |
COLUMN(mixed $format = NULL
) : \salt\DAOConverter
mixed
(Optional, NULL) the format to use
\salt\DAOConverter
Converter for display the column of fieldFORM(mixed $format = NULL
) : \salt\DAOConverter
mixed
(Optional, NULL) format to use
\salt\DAOConverter
Converter 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\Model
the Model objectSQL(mixed $format = NULL
) : \salt\DAOConverter
mixed
(Optional, NULL) format to use
\salt\DAOConverter
Converter for retrieve SQL field valueVIEW(mixed $format = NULL
) : \salt\DAOConverter
mixed
(Optional, NULL) format to use
\salt\DAOConverter
Converter for display the value of field__construct(array<mixed,string> $loadedFields= NULL
, array<mixed,string> $extraFields= NULL
, boolean $loadAsNew= FALSE
, boolean $fromQueryAPI= FALSE
)
Have to be called by child classes for having an internal ID
inherited_from | \salt\Identifiable::__construct() |
---|
array<mixed,string>
fields loaded by a query for this object. NULL if object created manually (default)
array<mixed,string>
fields to add to instance of new objects. Useless for classic usage.
boolean
(Optional, FALSE) if TRUE, the afterLoad() method set the state to NEW instead of LOADED
boolean
(Optional, FALSE) TRUE means all date are converted to timestamp in SQL, FALSE means all date are NOT converted
__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
mixed
the value of the field__set(string $fieldName, mixed $value)
string
the field to change
mixed
the value
addExtraField(string $extraField)
string
field name
\salt\SaltException |
if field name is a regular field |
---|
checkNotState(integer|array<mixed,integer> $state, string $message = NULL
)
integer
array<mixed,integer>
forbidden states for the object
string
error message for exception
\salt\SaltException |
if the object is in one of the forbidden states |
---|
checkState(integer|array<mixed,integer> $state)
integer
array<mixed,integer>
expected states for the object
\salt\SaltException |
if the object is not in one of the expected states |
---|
deleteQuery() : \salt\DeleteQuery
\salt\DeleteQuery
the delete querygetById(\salt\DBHelper $db, mixed $id) : static | NULL
\salt\DBHelper
The database to search object
mixed
a value of the id field
static
NULL
the 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\DBHelper
database 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
string
field name registered with metadata() or extra field constructor parameter
boolean
if TRUE, create extra field if not exists, throw SaltException otherwise
\salt\Field
getId() : mixed
mixed
value of id fieldgetIdField() : string
string
field namegetInternalId() : integer
integer
Unique 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
static
getTableName(boolean $withEscape = TRUE
) : string
boolean
(Optional, TRUE) FALSE for do not escape table name with backquotes
string
the table nameinitAfterCreateTable(\salt\DBHelper $db) : array<mixed,static>
\salt\DBHelper
database where table is created
array<mixed,static>
objects to create in tableisDeleted() : boolean
boolean
TRUE if the object have been deletedisLoaded() : boolean
boolean
TRUE if the object have been loaded for a database by PDOisModified() : boolean
boolean
TRUE if the object have been modifiedisNew() : boolean
boolean
TRUE if the object have been created with a new ...()isReadonly() : boolean
boolean
TRUE if the object is readonly (Base::singleton() is a readonly object)query(string $withField = FALSE
) : \salt\Query
string
TRUE for retrieve all fields, FALSE otherwise
\salt\Query
the empty query objectreadonly()
singleton() : static
static
a singleton instance of the objectupdateQuery(\salt\Query $fromQuery = NULL
) : \salt\UpdateQuery
\salt\Query
the query to use for update
\salt\UpdateQuery
the update querycheckFieldExists(string $fieldName, boolean $forValue= FALSE
, boolean $doNotThrowException= FALSE
) : boolean
string
boolean
also check field is loaded and value can be retrieve
boolean
return FALSE if field does not exists instead of throwing exception
\salt\SaltException |
if field don't exists or is not loaded (if $forValue) |
---|
boolean
TRUE 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
boolean
if 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