Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
formatrepository.php
1<?php
2
4
8
14{
16 protected $dataCollection;
17
22 public function __construct(array $params = [])
23 {
24 if(isset($params['dataCollection']) && is_subclass_of($params['dataCollection'], DataCollection::class))
25 {
26 $this->dataCollection = $params['dataCollection'];
27 }
28 else
29 {
30 $this->dataCollection = DataCollection::class;
31 }
32 }
33
38 public function findAll(string $language): array
39 {
40 $result = [];
41
42 foreach ($this->dataCollection::getAll($language) as $data)
43 {
44 $result[] = ArrayConverter::convertFromArray($data, $language);
45 }
46
47 return $result;
48 }
49
55 public function findByCode(string $code, string $languageId):? Entity\Format
56 {
57 $data = $this->dataCollection::getByCode($code, $languageId);
58 return is_array($data) ? ArrayConverter::convertFromArray($data, $languageId) : null;
59 }
60}
findByCode(string $code, string $languageId)