Categories
class Categories extends DolibarrApi (View source)
API class for categories
Properties
| protected DoliDB | $db | from DolibarrApi | |
| Restler | $r | from DolibarrApi | |
| static string[] | $FIELDS | ||
| Categorie | $category |
Methods
Constructor
Check and convert a string depending on its type/name.
Filter properties that will be returned on object
Clean sensible object datas
Check access by user to a given resource
Return if a $sqlfilters parameter is valid Function no more used. Kept for backward compatibility with old APIs of modules
Function to forge a SQL criteria from a Generic filter string.
Get properties of a category object
List categories
Create category object
Update category
Delete category
List categories of an object
Link an object to a category by id
Link an object to a category by ref
Unlink an object from a category by id
Unlink an object from a category by ref
Get the list of objects in a category.
Details
__construct()
Constructor
protected string|array<string, mixed>
_checkValForAPI(string $field, string|string[] $value, object $object)
Check and convert a string depending on its type/name.
protected object
_filterObjectProperties(object $object, string $properties)
Filter properties that will be returned on object
protected object
_cleanObjectDatas(object $object)
Clean sensible object datas
static protected bool
_checkAccessToResource(string $resource, int $resource_id = 0, string $dbtablename = '', string $feature2 = '', string $dbt_keyfield = 'fk_soc', string $dbt_select = 'rowid')
Check access by user to a given resource
protected bool|string
_checkFilters(string $sqlfilters, string $error = '')
Return if a $sqlfilters parameter is valid Function no more used. Kept for backward compatibility with old APIs of modules
static protected string
_forge_criteria_callback(string[] $matches)
Function to forge a SQL criteria from a Generic filter string.
Function no more used. Kept for backward compatibility with old APIs of modules
array
get(int $id, bool $include_childs = false)
Get properties of a category object
Return an array with category information
array
index(string $sortfield = "t.rowid", string $sortorder = 'ASC', int $limit = 100, int $page = 0, string $type = '', string $sqlfilters = '', string $properties = '')
List categories
Get a list of categories according to filters
int
post(array $request_data = null)
Create category object
object
put(int $id, array $request_data = null)
Update category
array
delete(int $id)
Delete category
array
getListForObject(int $id, string $type, string $sortfield = "s.rowid", string $sortorder = 'ASC', int $limit = 0, int $page = 0)
List categories of an object
Get the list of categories linked to an object
array
linkObjectById(int $id, string $type, int $object_id)
Link an object to a category by id
array
linkObjectByRef(int $id, string $type, string $object_ref)
Link an object to a category by ref
array
unlinkObjectById(int $id, string $type, int $object_id)
Unlink an object from a category by id
array
unlinkObjectByRef(int $id, string $type, string $object_ref)
Unlink an object from a category by ref
mixed
getObjects(int $id, string $type, int $onlyids = 0)
Get the list of objects in a category.