Skip to content

Instantly share code, notes, and snippets.

@nizom333
Last active October 26, 2022 13:14
Show Gist options
  • Save nizom333/9d212545e7b19f6a7d4d2ddda5862420 to your computer and use it in GitHub Desktop.
Save nizom333/9d212545e7b19f6a7d4d2ddda5862420 to your computer and use it in GitHub Desktop.
Bitrix D7 ElementTable with PropertyTable
<?php
$coursesObject = \Bitrix\Iblock\ElementTable::getList([
'filter' => [
"ID" => array_column($response['value'], 'productSerialNumber')
],
'select' => [
'ID',
'NAME',
'PROPERTY_CENTER_ID' => 'PROPERTY_CENTER.VALUE',
'CENTER_NAME' => 'CENTER.NAME'
],
'runtime' => [
new \Bitrix\Main\Entity\ReferenceField(
'PROPERTY_CENTER',
Bitrix\Iblock\ElementPropertyTable::class,
\Bitrix\Main\Entity\Query\Join::on('this.ID', 'ref.IBLOCK_ELEMENT_ID')
->where('ref.IBLOCK_PROPERTY_ID', '2') // 2 == PROPERTY_ID
->whereNotNull("ref.IBLOCK_ELEMENT_ID")
),
new \Bitrix\Main\Entity\ReferenceField(
'CENTER',
\Bitrix\Iblock\ElementTable::class,
\Bitrix\Main\Entity\Query\Join::on('this.PROPERTY_CENTER_ID', 'ref.ID')->whereNotNull("ref.ID")
),
]
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment