Preference is a key value class, it save and get value just like session / cookie
This is a plan to save string value, Object, Model1, in database
Class DbPref1
Methods summary
public static
Model1
|
|
public static
|
|
public static
|
|
public static
|
|
public static
boolean|mysqli_result|null
|
#
save( $name, null $object_or_keyValueArray = null, string $user_id = '', boolean $replace = true )
Insert New / Append / Override Existing data
Insert New / Append / Override Existing data
Parameters
- $name
- $object_or_keyValueArray
- $user_id
- $replace
Returns
boolean|mysqli_result|null
Throws
Exception
|
public static
boolean
|
#
delete( null $name = null, string $user_id = '' )
Parameters
Returns
boolean
Throws
Exception
|
public static
boolean
|
#
deleteRaw( array $where = ['name'=>'', 'user_id'=>''], string $login = ' AND ', string $operator = ' = ' )
Parameters
Returns
boolean
Throws
Exception
|
public static
array
|
#
normalizeRawRows( array $rowList = [] )
Convert List of Data to Object Like
Convert List of Data to Object Like
Parameters
Returns
array
|
public static
array|Model1
|
#
get( $name, string $user_id = '', null $convertToClassName = null )
Get Normalized Data
Parameters
- $name
- $user_id
- $convertToClassName
Returns
|
public static
array|Model1
|
#
getMany( string $nameLike = '_', string $user_id = '', string $nameFormat = '%{data}%' )
Get Likely Data Using With
Get Likely Data Using With
Parameters
- $nameLike
- $user_id
- $nameFormat
- : use $nameFormat '%{data}%' for like data, or single % for either left or right
Returns
|
public static
array|Model1
|
#
getManyIfStartWith( string $namePrefix = '_', string $user_id = '' )
Get Start With Data
Parameters
Returns
|
public static
array|Model1
|
#
getManyIfContain( string $name = '_', string $user_id = '' )
Get Start With Data
Parameters
Returns
|
public static
array|Model1
|
#
getManyIfEndWith( string $nameSuffix = '_', string $user_id = '' )
Get End With Data
Parameters
Returns
|
public static
array|ArrayObject|boolean|mysqli_result|null
|
#
getRawRows( array $where = ['name'=>'', 'user_id'=>''], string $login = ' AND ', string $operator = ' = ' )
Get All Row
Parameters
Returns
array|ArrayObject|boolean|mysqli_result|null
|
public static
array
|
#
getByUser( string $user_id = '' )
Get Associated User Info
Parameters
Returns
array
|
public static
boolean
|
#
exists( $name, string $user_id = '' )
Is Model Exists
Parameters
Returns
boolean
|