32 throw new \OutOfRangeException($id);
42 return reset($entities) ?:
null;
49 foreach ($this->
getList((array)$params) as $item)
64 foreach ($entities as $entity)
66 \CFile::Delete($entity->getId());
74 $collection = $this->factory->createCollection();
75 if ($element->
isNew())
83 if ($previewValue > 0)
88 $items[] = $previewEntity;
98 $items[] = $detailEntity;
102 foreach ($this->getMorePhotoEntities($element) as $item)
109 $collection->add(...$items);
124 $morePhotoValueCollection = $property->getPropertyValueCollection();
125 $morePhotoIds = $morePhotoValueCollection->getValues();
126 if (empty($morePhotoIds))
132 '=ID' => $morePhotoIds,
141 $fields = array_combine(array_column($fields,
'ID'), $fields);
143 foreach ($morePhotoValueCollection as $value)
145 $fileId = (int)$value->getValue();
146 if ($fileId > 0 && isset($fields[$fileId]))
148 $fileFields = $fields[$fileId];
149 if (empty($fileFields))
153 $fileFields[
'PROPERTY_VALUE_ID'] = $value->getId();
161 protected function getList(array $params): array
164 $filesRaw = FileTable::getList($params);
165 while ($file = $filesRaw->fetch())
167 $file[
'SRC'] = \CFile::getFileSRC($file);
168 $file[
'FILE_STRUCTURE'] = $file;
177 $entity = $this->factory->createEntity($type);