Last active
October 26, 2022 13:14
-
-
Save nizom333/9d212545e7b19f6a7d4d2ddda5862420 to your computer and use it in GitHub Desktop.
Bitrix D7 ElementTable with PropertyTable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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