1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
MetaTypeConverter.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
5namespace Bitrix\Socialnetwork\Collab\Controller\Meta;
6
7use Bitrix\Main\UI\EntitySelector\Converter;
8use Bitrix\Socialnetwork\Collab\Controller\Meta\Attribute\MetaType;
9use Bitrix\Socialnetwork\Collab\Controller\Meta\Attribute\PropertyMetaType;
10use ReflectionProperty;
11
13{
14 public static function getMetaType(string $class, string $property): ?PropertyMetaType
15 {
16 $reflection = new ReflectionProperty($class, $property);
17 $attributes = $reflection->getAttributes(MetaType::class);
18
19 foreach ($attributes as $attribute)
20 {
22 $attributeInstance = $attribute->newInstance();
23
24 return $attributeInstance->type;
25 }
26
27 return null;
28 }
29
30 public static function convert(PropertyMetaType $type, mixed $value): mixed
31 {
32 if ($type === PropertyMetaType::MemberSelectorCodes)
33 {
34 return Converter::convertToFinderCodes($value);
35 }
36
37 return $value;
38 }
39}
$type
Определения options.php:106
static convert(PropertyMetaType $type, mixed $value)
Определения MetaTypeConverter.php:30