Skip to content

Commit c1658b2

Browse files
committed
Add field names of related entities
1 parent 92bc989 commit c1658b2

16 files changed

Lines changed: 665 additions & 362 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.idea/
12
examples/
23
logs/
34

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019-2020 andrey-tech
3+
Copyright (c) 2019-2021 andrey-tech
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 124 additions & 65 deletions
Large diffs are not rendered by default.

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
],
1515
"require": {
1616
"php": ">=7.0",
17+
"ext-json": "*",
1718
"andrey-tech/http-client-php": "^2.8",
1819
"andrey-tech/debug-logger-php": "^1.8"
1920
},

src/App/Bitrix24/Activity.php

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
<?php
22

33
/**
4-
* Трейт Actibity. Методы для работы с делами (активностями) в системе Bitrix24.
4+
* Трейт Activity. Методы для работы с делами (активностями) в системе Bitrix24.
55
*
66
* @author andrey-tech
7-
* @copyright 2019-2020 andrey-tech
8-
* @see https://github.com/andrey-tech/bitrix24-api-php
7+
* @copyright 2019-2021 andrey-tech
8+
* @see https://github.com/andrey-tech/bitrix24-api-php
99
* @license MIT
1010
*
11-
* @version 1.0.0
11+
* @version 1.0.1
1212
*
1313
* v1.0.0 (02.12.2019) Начальная версия
14-
*
14+
* v1.0.1 (03.03.2021) Исправлено имя класса исключения в методах
1515
*/
16-
declare(strict_types = 1);
16+
17+
declare(strict_types=1);
1718

1819
namespace App\Bitrix24;
1920

2021
trait Activity
2122
{
2223
/**
23-
* Возвращает списoк названий полей активности
24+
* Возвращает список названий полей активности
25+
*
2426
* @return array
2527
*/
2628
public function getActivityFields()
@@ -30,7 +32,8 @@ public function getActivityFields()
3032

3133
/**
3234
* Возвращает активность по ID
33-
* @param int|string $activityId ID активности
35+
*
36+
* @param int|string $activityId ID активности
3437
* @return array|null
3538
*/
3639
public function getActivity($activityId)
@@ -41,12 +44,13 @@ public function getActivity($activityId)
4144
'id' => $activityId
4245
]
4346
);
44-
47+
4548
return $activity;
4649
}
4750

4851
/**
4952
* Добавляет активность
53+
*
5054
* @param array $fields Список полей активности
5155
* @return int
5256
*/
@@ -66,10 +70,11 @@ public function addActivity(array $fields = [])
6670

6771
/**
6872
* Пакетно добавляет активности
73+
*
6974
* @param array $activities Массив параметров активностей
7075
* @return array Массив id активностей
7176
*/
72-
public function addActivities(array $activities = []) :array
77+
public function addActivities(array $activities = []): array
7378
{
7479
// Id добавленных активностей
7580
$activityResults = [];
@@ -90,7 +95,7 @@ public function addActivities(array $activities = []) :array
9095
$received = count($activityResult);
9196
if ($received != $sent) {
9297
$jsonResponse = $this->toJSON($this->lastResponse);
93-
throw new Bitrix24Exception(
98+
throw new Bitrix24APIException(
9499
"Невозможно пакетно добавить активности ({$sent}/{$received}): {$jsonResponse}"
95100
);
96101
}

0 commit comments

Comments
 (0)