Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
### Security
-->

## 1.1.0 – 2024.09.
## 1.1.0 – 2024.09.12

### Added

Expand All @@ -27,6 +27,8 @@
`/examples/local-application/`
- Changed bitrix24-php-sdk version in headers in class `Bitrix24\SDK\Core\ApiClient`,
see [wrong API-client and sdk version in headers](https://github.com/bitrix24/b24phpsdk/issues/13).
- Changed scope for property `core` in `Bitrix24\SDK\Services\AbstractServiceBuilder` - for better DX,
see [Make core public in service builder](https://github.com/bitrix24/b24phpsdk/issues/26).

### Fixed

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ $b24Service = ServiceBuilderFactory::createServiceBuilderFromWebhook('INSERT_HER

// call some method
var_dump($b24Service->getMainScope()->main()->getApplicationInfo()->applicationInfo());
// call core for method in not implemented service
var_dump($b24Service->core->call('user.current'));

```
5. Call php file in shell

Expand Down
6 changes: 4 additions & 2 deletions examples/webhook/example.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
require_once 'vendor/autoload.php';

// init bitrix24-php-sdk service from webhook
$b24Service = ServiceBuilderFactory::createServiceBuilderFromWebhook('INSERT_HERE_YOUR_WEBHOOK_URL');
$b24Service = ServiceBuilderFactory::createServiceBuilderFromWebhook('https://bitrix24-php-sdk-playground.bitrix24.ru/rest/1/b6g6r1zr85pzzpw5/');

// call some method
var_dump($b24Service->getMainScope()->main()->getApplicationInfo()->applicationInfo());
var_dump($b24Service->getMainScope()->main()->getApplicationInfo()->applicationInfo());
// call core
var_dump($b24Service->core->call('user.current'));
33 changes: 10 additions & 23 deletions src/Services/AbstractServiceBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,29 @@

namespace Bitrix24\SDK\Services;


use Bitrix24\SDK\Core\Contracts\BatchOperationsInterface;
use Bitrix24\SDK\Core\Contracts\BulkItemsReaderInterface;
use Bitrix24\SDK\Core\Contracts\CoreInterface;
use Psr\Log\LoggerInterface;

/**
* Class AbstractServiceBuilder
*
* @package Bitrix24\SDK\Services
*/
abstract class AbstractServiceBuilder
{
protected CoreInterface $core;
protected BatchOperationsInterface $batch;
protected BulkItemsReaderInterface $bulkItemsReader;
protected LoggerInterface $log;
protected array $serviceCache;

/**
* AbstractServiceBuilder constructor.
*
* @param CoreInterface $core
* @param BatchOperationsInterface $batch
* @param \Bitrix24\SDK\Core\Contracts\BulkItemsReaderInterface $bulkItemsReader
* @param LoggerInterface $log
* @param CoreInterface $core
* @param BatchOperationsInterface $batch
* @param BulkItemsReaderInterface $bulkItemsReader
* @param LoggerInterface $log
*/
public function __construct(
CoreInterface $core,
BatchOperationsInterface $batch,
BulkItemsReaderInterface $bulkItemsReader,
LoggerInterface $log
) {
$this->core = $core;
$this->batch = $batch;
$this->bulkItemsReader = $bulkItemsReader;
$this->log = $log;
public CoreInterface $core,
protected BatchOperationsInterface $batch,
protected BulkItemsReaderInterface $bulkItemsReader,
protected LoggerInterface $log
)
{
}
}