Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/ilovecveti.ru/bitrix/modules/socialnetwork/lib/internals/group/ |
Upload File : |
<?php declare(strict_types=1); namespace Bitrix\Socialnetwork\Internals\Group; use Bitrix\Main\ORM\Fields\UserTypeField; use Bitrix\Main\Type\Contract\Arrayable; use Bitrix\Socialnetwork\EO_Workgroup; use Bitrix\Socialnetwork\Item\Workgroup\Type; class GroupEntity extends EO_Workgroup { public static function wakeUpObject(null|array|Arrayable $data): static { if ($data instanceof Arrayable) { $data = $data->toArray(); } if (!is_array($data)) { return new static(); } $fields = static::$dataClass::getEntity()->getFields(); $wakeUpData = []; $customData = []; foreach ($data as $field => $value) { if (array_key_exists($field, $fields)) { if ( $fields[$field] instanceof UserTypeField && is_array($value) && isset($value['VALUE']) ) { $value = $value['VALUE']; } $wakeUpData[$field] = $value; } else { $customData[$field] = $value; } } $object = parent::wakeUp($wakeUpData); foreach ($customData as $field => $value) { $object->customData->set($field, $value); } return $object; } public function isProject(): bool { return $this->typeIs(Type::Project); } public function isScrum(): bool { return $this->typeIs(Type::Scrum); } public function isGroup(): bool { return $this->typeIs(Type::Group); } public function typeIs(Type $type): bool { return $this->getType() === $type->value; } }