3declare(strict_types=1);
9use Bitrix\Socialnetwork\Collab\Controller\Trait\ConvertRequestToArrayTrait;
11use ReflectionProperty;
15 use ConvertRequestToArrayTrait;
21 $requestData = static::convertRequest(
$request);
23 $reflection =
new ReflectionClass(static::class);
25 foreach ($requestData as
$key => $value)
27 if ($reflection->hasProperty(
$key))
29 $dto[
$key] = static::cast(
$key, $value);
33 return new static(...$dto);
36 protected static function cast(
string $key, mixed $value): mixed
38 $reflection =
new ReflectionProperty(static::class,
$key);
39 $type = $reflection->getType()?->getName();
45 $metaType = MetaTypeConverter::getMetaType(static::class,
$key);
46 if ($metaType !==
null)
54 'float' => (
float)$value,
55 'string' => (string)$value,
56 'array' => (
array)$value,
57 'bool' => (bool)$value,
65 foreach ($this as
$key => $value)
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
static createFromRequest(mixed $request)
static cast(string $key, mixed $value)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(empty($signedUserToken)) $key