dolibarr 23.0.3
KnowledgeManagement Class Reference
Inheritance diagram for KnowledgeManagement:
Collaboration diagram for KnowledgeManagement:

Public Member Functions

 __construct ()
 Constructor.
 
 get ($id)
 Get properties of a knowledgerecord object.
 
 getCategories ($id, $sortfield="s.rowid", $sortorder='ASC', $limit=0, $page=0)
 Get categories for a knowledgerecord object.
 
 index ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $category=0, $sqlfilters='', $properties='', $pagination_data=false)
 List knowledgerecords.
 
 post ($request_data=null)
 Create knowledgerecord object.
 
 put ($id, $request_data=null)
 Update knowledgerecord.
 
 delete ($id)
 Delete knowledgerecord.
 
 validate ($id, $notrigger=0)
 Validate a knowledge.
 
 cancel ($id, $notrigger=0)
 Cancel a knowledge.
 
- Public Member Functions inherited from DolibarrApi
 __construct ($db, $cachedir='', $refreshCache=false)
 Constructor.
 

Protected Member Functions

 _cleanObjectDatas ($object)
 Clean sensible object datas @phpstan-template T.
 
- Protected Member Functions inherited from DolibarrApi
 _checkValForAPI ($field, $value, $object)
 Check and convert a string depending on its type/name.
 
 _filterObjectProperties ($object, $properties)
 Filter properties that will be returned on object.
 
 _checkFilters ($sqlfilters, &$error='')
 Return if a $sqlfilters parameter is valid Function no more used.
 

Private Member Functions

 _validate ($data)
 Validate fields before create or update object.
 

Additional Inherited Members

- Static Protected Member Functions inherited from DolibarrApi
static _checkAccessToResource ($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
 Check access by user to a given resource.
 
static _forge_criteria_callback ($matches)
 Function to forge a SQL criteria from a Generic filter string.
 

Detailed Description

Definition at line 41 of file api_knowledgemanagement.class.php.

Constructor & Destructor Documentation

◆ __construct()

KnowledgeManagement::__construct ( )

Constructor.

@url GET /

Definition at line 53 of file api_knowledgemanagement.class.php.

Member Function Documentation

◆ _cleanObjectDatas()

KnowledgeManagement::_cleanObjectDatas ( $object)
protected

Clean sensible object datas @phpstan-template T.

Parameters
Object$objectObject to clean
Returns
Object Object with cleaned properties @phpstan-param T $object @phpstan-return T

Reimplemented from DolibarrApi.

Definition at line 392 of file api_knowledgemanagement.class.php.

References $object, and _cleanObjectDatas().

Referenced by _cleanObjectDatas(), cancel(), get(), index(), and validate().

◆ _validate()

KnowledgeManagement::_validate ( $data)
private

Validate fields before create or update object.

Parameters
?array<string,string>$data Array of data to validate
Returns
array<string,string>
Exceptions
RestException

Definition at line 529 of file api_knowledgemanagement.class.php.

Referenced by post().

◆ cancel()

KnowledgeManagement::cancel ( $id,
$notrigger = 0 )

Cancel a knowledge.

If you get a bad value for param notrigger check, provide this in body { "notrigger": 0 }

Parameters
int$idknowledge ID
int$notrigger1=Does not execute triggers, 0= execute triggers

@url POST {id}/cancel

Returns
Object

Definition at line 499 of file api_knowledgemanagement.class.php.

References $id, and _cleanObjectDatas().

◆ delete()

KnowledgeManagement::delete ( $id)

Delete knowledgerecord.

Parameters
int$idKnowledgeRecord ID
Returns
array @phan-return array{success:array{code:int,message:string}} @phpstan-return array{success:array{code:int,message:string}}
Exceptions
RestException

@url DELETE knowledgerecords/{id}

Definition at line 355 of file api_knowledgemanagement.class.php.

References $id, and DolibarrApi\_checkAccessToResource().

◆ get()

KnowledgeManagement::get ( $id)

Get properties of a knowledgerecord object.

Return an array with knowledgerecord information

Parameters
int$idID of knowledgerecord
Returns
Object Object with cleaned properties

@url GET knowledgerecords/{id}

Exceptions
RestException403 Not allowed
RestException404 Not found

Definition at line 73 of file api_knowledgemanagement.class.php.

References $id, DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().

◆ getCategories()

KnowledgeManagement::getCategories ( $id,
$sortfield = "s.rowid",
$sortorder = 'ASC',
$limit = 0,
$page = 0 )

Get categories for a knowledgerecord object.

Parameters
int$idID of knowledgerecord object
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
Returns
mixed

@url GET /knowledgerecords/{id}/categories

Definition at line 104 of file api_knowledgemanagement.class.php.

References $id.

◆ index()

KnowledgeManagement::index ( $sortfield = "t.rowid",
$sortorder = 'ASC',
$limit = 100,
$page = 0,
$category = 0,
$sqlfilters = '',
$properties = '',
$pagination_data = false )

List knowledgerecords.

Get a list of knowledgerecords

Parameters
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
int$categoryUse this param to filter list by category
string$sqlfiltersOther criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
string$propertiesRestrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
bool$pagination_dataIf this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0*
Returns
array Array of order objects @phan-return KnowledgeRecord[]|array{data:KnowledgeRecord[],pagination:array{total:int,page:int,page_count:int,limit:int}} @phpstan-return KnowledgeRecord[]|array{data:KnowledgeRecord[],pagination:array{total:int,page:int,page_count:int,limit:int}}
Exceptions
RestException

@url GET /knowledgerecords/

Definition at line 142 of file api_knowledgemanagement.class.php.

References _cleanObjectDatas(), DolibarrApi\_filterObjectProperties(), and forgeSQLFromUniversalSearchCriteria().

◆ post()

KnowledgeManagement::post ( $request_data = null)

Create knowledgerecord object.

Parameters
array$request_dataRequest data @phan-param ?array<string,string> $request_data @phpstan-param ?array<string,string> $request_data
Returns
int ID of knowledgerecord
Exceptions
RestException

@url POST knowledgerecords/

Definition at line 257 of file api_knowledgemanagement.class.php.

References DolibarrApi\_checkValForAPI(), _validate(), and sanitizeVal().

◆ put()

KnowledgeManagement::put ( $id,
$request_data = null )

Update knowledgerecord.

Parameters
int$idId of knowledgerecord to update
array$request_dataData @phan-param ?array<string,string> $request_data @phpstan-param ?array<string,string> $request_data
Returns
Object Updated object
Exceptions
RestException

@url PUT knowledgerecords/{id}

Definition at line 298 of file api_knowledgemanagement.class.php.

References $id, DolibarrApi\_checkAccessToResource(), DolibarrApi\_checkValForAPI(), and sanitizeVal().

◆ validate()

KnowledgeManagement::validate ( $id,
$notrigger = 0 )

Validate a knowledge.

If you get a bad value for param notrigger check, provide this in body { "notrigger": 0 }

Parameters
int$idknowledge ID
int$notrigger1=Does not execute triggers, 0= execute triggers

@url POST {id}/validate

Returns
Object

Definition at line 462 of file api_knowledgemanagement.class.php.

References $id, and _cleanObjectDatas().


The documentation for this class was generated from the following file: