execut/yii2-1c-odata

Yii2 component for work with 1C oData via activeRecord

Maintainers

👁 execut

Package info

github.com/execut/yii2-1c-odata

Type:yii2-extension

pkg:composer/execut/yii2-1c-odata

Statistics

Installs: 1 504

Dependents: 0

Suggesters: 0

Stars: 10

Open Issues: 3

0.1.8 2021-07-15 03:58 UTC

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

Apache-2.0 9e59f619b7fc0490d9aa9765d255dede34316990

  • eXeCUT

activerecordyii2odata

This package is auto-updated.

Last update: 2026-06-15 15:20:39 UTC


README

Installation

The preferred way to install this extension is through composer.

Install

Either run

$ php composer.phar require execut/yii2-1c-odata "dev-master"

or add

"execut/yii2-1c-odata": "dev-master"

to the require section of your composer.json file.

Configuration example

Add to application config folowing rules:

[
 'components' => [
 'oData' => [
 'class' => \execut\oData\Client::class,
 'host' => $odataHost,
 'path' => $odataPath,
 'options' => [
 'auth' => [
 $odataLogin,
 $odataPassword,
 ],
 ],
 'customColumnsTypes' => [
 // Here you custom columns types stubs configuration. Example:
 'Catalog_Контрагенты' => [
 'НаименованиеПолное' => 'text',
 ],
 ],
 ],
 ],
];

After configuration, you must declare your models and queries on the basis of two classes: execut\oData\ActiveRecord and execut\oData\ActiveQuery

Example model for standard document ЧекККМ (source here):

use execut\oData\ActiveRecord;

class CheckKkm extends ActiveRecord
{
 public $complexRelations = [
 'Оплата',
 'Заказы'
 ];

 public function getОплата() {
 return $this->hasMany(CheckKkmPayment::class, [
 'Ref_Key' => 'Ref_Key',
 ]);
 }

 public static function tableName()
 {
 return 'Document_ЧекККМ';
 }
}

$check = CheckKkm::find()->andWhere([
 'Ref_Key' => '00000000-0000-0000-0000-000000000001'
])->one();
if ($check) {
 $check->attributes = [
 //...
 ];
 $check->save();
}

Your help was, would be useful

For more information, there is not enough time =(

Planned

  • Unit tests cover
  • Extending functional to standard oData, without 1C

License

yii2-1c-odata is released under the Apache License Version 2.0. See the bundled LICENSE.md for details.