Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
BaseImage.php
1<?php
2
4
7
16abstract class BaseImage extends BaseEntity
17{
18 public const CODE = '';
19
20 public function __construct(ImageRepositoryContract $imageRepository)
21 {
22 parent::__construct($imageRepository);
23 }
24
25 public function getSource(): string
26 {
27 return (string)$this->getField('SRC');
28 }
29
30 public function getCode(): string
31 {
32 return static::CODE;
33 }
34
35 public function setFileStructure(array $fileFields): BaseImage
36 {
37 $this->setField('FILE_STRUCTURE', $fileFields);
38
39 return $this;
40 }
41
42 public function getFileStructure(): ?array
43 {
44 return $this->getField('FILE_STRUCTURE');
45 }
46
47 public function getPropertyValueId(): int
48 {
49 return (int)$this->getField('PROPERTY_VALUE_ID');
50 }
51
52 protected function getFieldsMap(): array
53 {
54 return [
55 'ID' => MapTypeCaster::NULLABLE_INT,
56 'PROPERTY_VALUE_ID' => MapTypeCaster::INT,
57 'SRC' => MapTypeCaster::STRING,
58 'WIDTH' => MapTypeCaster::INT,
59 'HEIGHT' => MapTypeCaster::INT,
60 'WEIGHT' => MapTypeCaster::INT,
61 'TIMESTAMP_X' => MapTypeCaster::DATETIME,
62 'FILE_NAME' => MapTypeCaster::STRING,
63 'FILE_STRUCTURE' => static function ($value) {
64 return is_array($value) ? $value : \CIBlock::makeFileArray(null, true);
65 },
66 ];
67 }
68}
setField(string $name, $value)
setFileStructure(array $fileFields)
Definition BaseImage.php:35
__construct(ImageRepositoryContract $imageRepository)
Definition BaseImage.php:20