vvasystem / o-data
OData Client for PHP
Installs: 2 260
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 1
Open Issues: 2
Requires
- php: >=7
- guzzlehttp/guzzle: ~6.0
- psr/log: ^1.0
Requires (Dev)
- phpunit/phpunit: ^6.1
This package is auto-updated.
Last update: 2025-01-19 22:34:59 UTC
README
Package OData is designed to connect to REST API "1C:Enterprise" using the OData protocol.
Install
Via Composer
$ composer require vvasystem/o-data
Usage
1. Create connection
$connection = ConnectionFactory::getInstance('http://localhost/test/odata/standard.odata', 'test', 'test');
2. Create table
TestTable.php
use OData\Client\Table; class TestTable extends Table { /** * @inheritdoc */ protected $_name = 'Catalog_Склады'; /** * @inheritdoc */ protected $_primary = 'Ref_Key'; }
$table = new TestTable(['connection' => $connection]);
3. Execute query
$resultRow = $table->insert([ 'Code' => 'Test', 'Discription' => 'Test', ]); \var_dump($resultRow); array(3) { ["Ref_Key"]=> string(36) "31b2c19f-e241-11e6-8108-005056a77adb" ["Code"]=> string(5) "Test" ["Discription"]=> string(5) "Test" } $resultRow = $table->update([ 'Code' => 'Test1', 'Discription' => 'Test1', ], '31b2c19f-e241-11e6-8108-005056a77adb'); $table->delete('31b2c19f-e241-11e6-8108-005056a77adb'); // For getting count of entries $count = $table->count(); // Running RPC $result = $table->call('SelectChanges', [ 'DataExchangePoint' => 'http://localhost/1c/odata/standard.odata/ExchangePlan_Обмен(guid'9d586f0e-afec-11e7-be8e-b888e3a9a739')', 'MessageNo' => '123456', ]);
License
The MIT License (MIT).