PHP code example of webarchitect609 / bitrix-orm-tools

1. Go to this page and download the library: Download webarchitect609/bitrix-orm-tools 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/ */

    

webarchitect609 / bitrix-orm-tools example snippets


     

use Bitrix\Iblock\ElementTable;
use Bitrix\Main\Entity\ReferenceField;
use Bitrix\Main\ORM\Query\Join;
use WebArch\BitrixOrmTools\Iblock\Property\DynamicSinglePropertiesTable;

class NewsSinglePropTable extends DynamicSinglePropertiesTable
{
    public static function getIblockId(): int
    {
        return 123;
    }
}

ElementTable::query()
            ->registerRuntimeField(
                new ReferenceField(
                    'NEWS_PROP',
                    NewsSinglePropTable::class,
                    Join::on('this.ID', 'ref.IBLOCK_ELEMENT_ID'),
                    ['join_type' => 'INNER']
                )
            );