本文整理匯總了PHP中Bitrix\Iblock\PropertyTable::getById方法的典型用法代碼示例。如果您正苦於以下問題:PHP PropertyTable::getById方法的具體用法?PHP PropertyTable::getById怎麽用?PHP PropertyTable::getById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Bitrix\Iblock\PropertyTable
的用法示例。
在下文中一共展示了PropertyTable::getById方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: applySnapshot
/**
* @param $data
* @param null $dbVersion
* @throws \Exception
* @return ApplyResult
*/
public function applySnapshot($data, $dbVersion = null)
{
$data = $this->handleNullValues($data);
$prop = new \CIBlockProperty();
$res = new ApplyResult();
$extId = $data['ID'];
if ($dbVersion) {
$data['IBLOCK_ID'] = $this->getReferenceController()->getCurrentIdByOtherVersion($data['IBLOCK_ID'], ReferenceController::GROUP_IBLOCK, $dbVersion);
$id = $this->getCurrentVersionId($extId, $dbVersion);
} else {
$id = $extId;
}
if (!$dbVersion && !PropertyTable::getById($id)->fetch()) {
unset($data['VERSION']);
$addRes = PropertyTable::add(array('ID' => $id, 'NAME' => $data['NAME'], 'IBLOCK_ID' => $data['IBLOCK_ID']));
if (!$addRes->isSuccess()) {
throw new \Exception('Ќе удалось возобновить свойство текущей версии. ' . implode(', ', $addRes->getErrorMessages()) . "\n" . var_export($data, true));
}
}
if ($id && PropertyTable::getById($id)->fetch()) {
$res->setSuccess((bool) $prop->Update($id, $data));
} else {
$res->setSuccess((bool) ($id = $prop->Add($data)));
$this->registerCurrentVersionId($id, $this->getReferenceValue($extId, $dbVersion));
}
$res->setId($id);
if ($data['PROPERTY_TYPE'] == self::LIST_TYPE_SIGN && !empty($data['~property_list_values'])) {
$this->_applyPropertyListTypeValues($id, $data['~property_list_values']);
}
return $res->setMessage($prop->LAST_ERROR);
}