Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
formatrepository.php
1
<?php
2
3
namespace
Bitrix\Location\Repository
;
4
5
use
Bitrix\Location\Entity
;
6
use
Bitrix\Location\Repository\Format\DataCollection
;
7
use
Bitrix\Location\Entity\Format\Converter\ArrayConverter
;
8
13
class
FormatRepository
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
}
Bitrix\Location\Entity\Format\Converter\ArrayConverter
Definition
arrayconverter.php:14
Bitrix\Location\Entity\Format
Definition
format.php:18
Bitrix\Location\Repository\Format\DataCollection
Definition
datacollection.php:11
Bitrix\Location\Repository\FormatRepository
Definition
formatrepository.php:14
Bitrix\Location\Repository\FormatRepository\findAll
findAll(string $language)
Definition
formatrepository.php:38
Bitrix\Location\Repository\FormatRepository\__construct
__construct(array $params=[])
Definition
formatrepository.php:22
Bitrix\Location\Repository\FormatRepository\$dataCollection
$dataCollection
Definition
formatrepository.php:16
Bitrix\Location\Repository\FormatRepository\findByCode
findByCode(string $code, string $languageId)
Definition
formatrepository.php:55
Bitrix\Main\ORM\Entity
Definition
entity.php:26
Bitrix\Location\Entity
Definition
address.php:3
Bitrix\Location\Repository
Definition
addressrepository.php:3
modules
location
lib
repository
formatrepository.php
Создано системой
1.10.0