|
| __construct (Client $client, $model_name) |
|
| getList ($options=[], $offset=0, $limit=0) |
|
| getRelated ($id, $link, $options=[], $offset=0, $limit=0) |
|
| addRelated ($id, $link, $data) |
|
| deleteRelated ($id, $link, $rel_id) |
|
| get ($id, array $fields=[]) |
|
| create ($data) |
|
| update ($id, $data, $create=false) |
|
| delete ($id) |
|
| metadata () |
|
| getAuditLogs ($parent_id=null, $offset=0, $limit=0) |
|
| getReports ($report_id=null, $offset=0, $limit=0) |
|
Used to work wit 1CRM data
OneCRM\APIClient\Model::addRelated |
( |
|
$id, |
|
|
|
$link, |
|
|
|
$data |
|
) |
| |
Adds a related record
$data
parameter can be in different forms:
- string with related record ID. Specified related record will be added to parent record via specified link
- array with related record IDs. Specified related records will be added to parent record via specified link
- associative array with keys containing related record IDs and values containing additional data:
$data = [
3d3e96d1-8d7c-acd6-e338-55b9b0cc5aae" => ["quantity" => 5]
];
//
- Parameters
-
$id | ID of parent record |
$link | Link name |
$data | Related data |
OneCRM\APIClient\Model::create |
( |
|
$data | ) |
|
Creates a new record
- Parameters
-
$data | Associative array with record data. Keys are field names, values are field values. |
- Returns
- New record ID
OneCRM\APIClient\Model::delete |
( |
|
$id | ) |
|
Deletes a record
- Parameters
-
- Returns
- true if record was deleted
OneCRM\APIClient\Model::deleteRelated |
( |
|
$id, |
|
|
|
$link, |
|
|
|
$rel_id |
|
) |
| |
Removes relationship between records
- Parameters
-
$id | ID of parent record |
$link | Link name |
$rel_id | ID of related record to remove |
OneCRM\APIClient\Model::get |
( |
|
$id, |
|
|
array |
$fields = [] |
|
) |
| |
Retrieves single record with specified ID
- Parameters
-
$id | Record ID |
$fields | List of fields to fetch |
OneCRM\APIClient\Model::getAuditLogs |
( |
|
$parent_id = null , |
|
|
|
$offset = 0 , |
|
|
|
$limit = 0 |
|
) |
| |
Get list of model audit logs.
- Parameters
-
string | $parent_id | parent record ID |
int | $offset | Starting offset |
int | $limit | Maximum number of records to return |
- Returns
- ListResult
- Exceptions
-
OneCRM\APIClient\Model::getList |
( |
|
$options = [] , |
|
|
|
$offset = 0 , |
|
|
|
$limit = 0 |
|
) |
| |
Get list of records.
- Parameters
-
$options | array with request options
fields : optional array with fields you want returned
filters : optional associative array with filters. Keys are filter names, values are filter values
order : optional sort order
query_favorite : optional boolean, if true, results will include is_favorite flag
filter_text : optional filter text, used for generic text search
|
$offset | Starting offset |
$limit | Maximum number of records to return |
OneCRM\APIClient\Model::getRelated |
( |
|
$id, |
|
|
|
$link, |
|
|
|
$options = [] , |
|
|
|
$offset = 0 , |
|
|
|
$limit = 0 |
|
) |
| |
Get list of related records.
- Parameters
-
$id | ID of parent record |
$link | Link name |
$options | array with request options
fields : optional array with fields you want returned
filters : optional associative array with filters. Keys are filter names, values are filter values
order : optional sort order
filter_text : optional filter text, used for generic text search
|
$offset | Starting offset |
$limit | Maximum number of records to return |
OneCRM\APIClient\Model::getReports |
( |
|
$report_id = null , |
|
|
|
$offset = 0 , |
|
|
|
$limit = 0 |
|
) |
| |
Get list of reports.
- Parameters
-
string | $report_id | report ID. If specified the method returns a list of archived runs |
int | $offset | Starting offset |
int | $limit | Maximum number of records to return |
- Returns
- ListResult
- Exceptions
-
OneCRM\APIClient\Model::metadata |
( |
| ) |
|
Retrieves fields and filters metadata
- Returns
- Array with metadata
OneCRM\APIClient\Model::update |
( |
|
$id, |
|
|
|
$data, |
|
|
|
$create = false |
|
) |
| |
Updates a record
- Parameters
-
$id | Record ID |
$data | Associative array with record data. Keys are field names, values are field values. |
$create | If true, the record will be created if it does not exist |
- Returns
- Always true
The documentation for this class was generated from the following file: