A
A
Alexander Solovey2020-08-13 23:18:19
1C-Bitrix
Alexander Solovey, 2020-08-13 23:18:19

How to get element properties via D7 API?

I'm trying to get the properties of an element with this code:

$element = \Bitrix\Iblock\Elements\ElementWebinarsruTable::getByPrimary($elementId, array(
    'select' => array('ID','NAME', 'WHAT')
))->fetchObject();
var_dump($element->getName()); // это значение элемента отдает
var_dump($element->getWhat()->getValue()); // это значение свойства вызывает ошибку

Error code:
Mysql query error: (1054) Unknown column 'iblock_element_prop_s7.VALUE' in 'field list' (400)
SELECT 
  `iblock_elements_element_webinarsru`.`ID` AS `ID`,
  `iblock_element_prop_s7`.`IBLOCK_ELEMENT_ID` AS `IBLOCK_ELEMENTS_ELEMENT_WEBINARSRU_WHAT_IBLOCK_ELEMENT_ID`,
  `iblock_element_prop_s7`.`PROPERTY_16` AS `IBLOCK_ELEMENTS_ELEMENT_WEBINARSRU_WHAT_VALUE`,
  `iblock_element_prop_s7`.`VALUE` AS `IBLOCK_ELEMENTS_ELEMENT_WEBINARSRU_WHAT_IBLOCK_GENERIC_VALUE`
FROM `b_iblock_element` `iblock_elements_element_webinarsru` 
INNER JOIN `b_iblock_element_prop_s7` `iblock_element_prop_s7` ON `iblock_elements_element_webinarsru`.`ID` = `iblock_element_prop_s7`.`IBLOCK_ELEMENT_ID`
WHERE `iblock_elements_element_webinarsru`.`ID` = 25 AND `iblock_elements_element_webinarsru`.`IBLOCK_ID` = 7

Please help me figure out what I'm doing wrong.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Solovey, 2020-08-28
@naghtigall

As a result, it turned out to be a Bitrix bug. Support replied that the bug will be fixed in the iblock module update 20.0.800.
And they sent a fix /bitrix/modules/iblock/lib/property.php to replace it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question