Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
sourcerepository.php
1
<?php
2
3
namespace
Bitrix\Location\Repository
;
4
5
use
Bitrix\Location\Entity\Source
;
6
use
Bitrix\Location\Model\SourceTable
;
7
13
final
class
SourceRepository
14
{
16
private
$ormConverter;
17
22
public
function
__construct
(
Source
\
OrmConverter
$ormConverter)
23
{
24
$this->ormConverter = $ormConverter;
25
}
26
33
public
function
findAll
(): array
34
{
35
$result = [];
36
37
$queryResult = SourceTable::getList();
38
39
while
($ormSource = $queryResult->fetchObject())
40
{
41
$result[] = $this->ormConverter->convertFromOrm($ormSource);
42
}
43
44
return
$result;
45
}
46
54
public
function
findByCode
(
string
$code): ?
Source
55
{
56
$result =
null
;
57
58
$ormSource = SourceTable::getList(
59
[
60
'filter'
=> [
61
'=CODE'
=> $code
62
],
63
'limit'
=> 1,
64
]
65
)->fetchObject();
66
67
if
(!$ormSource)
68
{
69
return
null
;
70
}
71
72
return
$this->ormConverter->convertFromOrm($ormSource);
73
}
74
82
public
function
save
(
Source
$source)
83
{
84
return
$this->ormConverter->convertToOrm($source)->save();
85
}
86
}
Bitrix\Location\Entity\Source\OrmConverter
Definition
ormconverter.php:16
Bitrix\Location\Entity\Source
Definition
source.php:17
Bitrix\Location\Model\SourceTable
Definition
sourcetable.php:27
Bitrix\Location\Repository\SourceRepository
Definition
sourcerepository.php:14
Bitrix\Location\Repository\SourceRepository\__construct
__construct(Source\OrmConverter $ormConverter)
Definition
sourcerepository.php:22
Bitrix\Location\Repository\SourceRepository\save
save(Source $source)
Definition
sourcerepository.php:82
Bitrix\Location\Repository\SourceRepository\findAll
findAll()
Definition
sourcerepository.php:33
Bitrix\Location\Repository\SourceRepository\findByCode
findByCode(string $code)
Definition
sourcerepository.php:54
Bitrix\Location\Entity\Source
Definition
config.php:3
Bitrix\Location\Repository
Definition
addressrepository.php:3
modules
location
lib
repository
sourcerepository.php
Создано системой
1.10.0