1
0
mirror of synced 2024-11-30 09:16:06 +03:00
bitrix-module/intaro.retailcrm/lib/repository/measurerepository.php
Сергей Чазов c3216f72d3
Optimize generator (#215)
2021-09-08 16:31:17 +03:00

43 lines
1.0 KiB
PHP

<?php
namespace Intaro\RetailCrm\Repository;
use Bitrix\Catalog\MeasureTable;
use Bitrix\Main\ArgumentException;
use Bitrix\Main\ObjectPropertyException;
use Bitrix\Main\SystemException;
/**
* Class MeasureRepository
* @package Intaro\RetailCrm\Repository
*/
class MeasureRepository
{
/**
* Получает доступные в Битриксе единицы измерения для товаров
*
* @return array
*/
public static function getMeasures(): array
{
$measures = [];
try {
$resMeasures = MeasureTable::query()
->addSelect('ID')
->addSelect('MEASURE_TITLE')
->addSelect('SYMBOL_INTL')
->addSelect('SYMBOL')
->fetchAll();
} catch (ObjectPropertyException | ArgumentException | SystemException $exception) {
return [];
}
foreach ($resMeasures as $resMeasure) {
$measures[$resMeasure['ID']] = $resMeasure;
}
return $measures;
}
}