PHP code example of execut / yii2-1c-odata

1. Go to this page and download the library: Download execut/yii2-1c-odata library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

execut / yii2-1c-odata example snippets


[
    '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',
                ],
            ],
        ],
    ],
];

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();
}

$ php composer.phar