Skip to content

Commit

Permalink
Add field names of related entities
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-tech committed Feb 4, 2021
1 parent 92bc989 commit c1658b2
Show file tree
Hide file tree
Showing 16 changed files with 665 additions and 362 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea/
examples/
logs/

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019-2020 andrey-tech
Copyright (c) 2019-2021 andrey-tech

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
189 changes: 124 additions & 65 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
],
"require": {
"php": ">=7.0",
"ext-json": "*",
"andrey-tech/http-client-php": "^2.8",
"andrey-tech/debug-logger-php": "^1.8"
},
Expand Down
27 changes: 16 additions & 11 deletions src/App/Bitrix24/Activity.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
<?php

/**
* Трейт Actibity. Методы для работы с делами (активностями) в системе Bitrix24.
* Трейт Activity. Методы для работы с делами (активностями) в системе Bitrix24.
*
* @author andrey-tech
* @copyright 2019-2020 andrey-tech
* @see https://github.com/andrey-tech/bitrix24-api-php
* @copyright 2019-2021 andrey-tech
* @see https://github.com/andrey-tech/bitrix24-api-php
* @license MIT
*
* @version 1.0.0
* @version 1.0.1
*
* v1.0.0 (02.12.2019) Начальная версия
*
* v1.0.1 (03.03.2021) Исправлено имя класса исключения в методах
*/
declare(strict_types = 1);

declare(strict_types=1);

namespace App\Bitrix24;

trait Activity
{
/**
* Возвращает списoк названий полей активности
* Возвращает список названий полей активности
*
* @return array
*/
public function getActivityFields()
Expand All @@ -30,7 +32,8 @@ public function getActivityFields()

/**
* Возвращает активность по ID
* @param int|string $activityId ID активности
*
* @param int|string $activityId ID активности
* @return array|null
*/
public function getActivity($activityId)
Expand All @@ -41,12 +44,13 @@ public function getActivity($activityId)
'id' => $activityId
]
);

return $activity;
}

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

/**
* Пакетно добавляет активности
*
* @param array $activities Массив параметров активностей
* @return array Массив id активностей
*/
public function addActivities(array $activities = []) :array
public function addActivities(array $activities = []): array
{
// Id добавленных активностей
$activityResults = [];
Expand All @@ -90,7 +95,7 @@ public function addActivities(array $activities = []) :array
$received = count($activityResult);
if ($received != $sent) {
$jsonResponse = $this->toJSON($this->lastResponse);
throw new Bitrix24Exception(
throw new Bitrix24APIException(
"Невозможно пакетно добавить активности ({$sent}/{$received}): {$jsonResponse}"
);
}
Expand Down
Loading

0 comments on commit c1658b2

Please sign in to comment.