class CGenericDic extends CommonDict (View source)

Class CGenericDic

Properties

DoliDB $db from  CommonDict
$error from  CommonDict
string[] $errors from  CommonDict
int $id from  CommonDict
?int $entity from  CommonDict
?string $code
?string $label
?int<0, 1> $active from  CommonDict
string $element
string $table_element
CtyperesourceLine[] $lines

Methods

__construct(DoliDB $db)

Constructor

int
create(User $user, int $notrigger = 0)

Create object into database

int
fetch(int $id, string $code = '', string $label = '')

Load object in memory from the database

int
fetchAll(string $sortorder = '', string $sortfield = '', int $limit = 0, int $offset = 0, string|string[] $filter = '', string $filtermode = 'AND')

Load object in memory from the database

int
update(User $user, int $notrigger = 0)

Update object into database

int
delete(User $user, int $notrigger = 0)

Delete object in database

int
createFromClone(User $user, int $fromid)

Load an object from its id and create a new one in database

int
initAsSpecimen()

Initialise object with example values Id must be 0 if object instance is a specimen

Details

__construct(DoliDB $db)

Constructor

Parameters

DoliDB $db

Database handler

int create(User $user, int $notrigger = 0)

Create object into database

Parameters

User $user

User that creates

int $notrigger

0=launch triggers after, 1=disable triggers

Return Value

int

Return integer <0 if KO, Id of created object if OK

int fetch(int $id, string $code = '', string $label = '')

Load object in memory from the database

Parameters

int $id

Id object

string $code code
string $label Label

Return Value

int

Return integer <0 if KO, 0 if not found, >0 if OK

int fetchAll(string $sortorder = '', string $sortfield = '', int $limit = 0, int $offset = 0, string|string[] $filter = '', string $filtermode = 'AND')

Load object in memory from the database

Parameters

string $sortorder

Sort Order

string $sortfield

Sort field

int $limit Limit
int $offset

offset limit

string|string[] $filter

filter USF

string $filtermode

filter mode (AND or OR)

Return Value

int

Return integer <0 if KO, >0 if OK

int update(User $user, int $notrigger = 0)

Update object into database

Parameters

User $user

User that modifies

int $notrigger

0=launch triggers after, 1=disable triggers

Return Value

int

Return integer <0 if KO, >0 if OK

int delete(User $user, int $notrigger = 0)

Delete object in database

Parameters

User $user

User that deletes

int $notrigger

0=launch triggers after, 1=disable triggers

Return Value

int

Return integer <0 if KO, >0 if OK

int createFromClone(User $user, int $fromid)

Load an object from its id and create a new one in database

Parameters

User $user

User making the clone

int $fromid

Id of object to clone

Return Value

int

New id of clone

int initAsSpecimen()

Initialise object with example values Id must be 0 if object instance is a specimen

Return Value

int