Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
addresscollection.php
1
<?php
2
3
namespace
Bitrix\Location\Entity\Address
;
4
5
use
Bitrix\Location\Entity\Address
;
6
use
Bitrix\Main\ArgumentTypeException
;
7
13
final
class
AddressCollection
extends
\Bitrix\Location\Entity\Generic\Collection
14
{
16
protected
$items
= [];
17
25
public
function
addItem
($address): int
26
{
27
if
(!($address instanceof
Address
))
28
{
29
throw
new
ArgumentTypeException
(
'address must be the instance of Address'
);
30
}
31
32
return
parent::addItem($address);
33
}
34
41
public
function
getAddressById
(
int
$addressId): ?
Address
42
{
43
foreach
($this->items as $item)
44
{
45
if
($item->getId() === $addressId)
46
{
47
return
$item;
48
}
49
}
50
51
return
null
;
52
}
53
}
Bitrix\Location\Entity\Address\AddressCollection
Definition
addresscollection.php:14
Bitrix\Location\Entity\Address\AddressCollection\$items
$items
Definition
addresscollection.php:16
Bitrix\Location\Entity\Address\AddressCollection\getAddressById
getAddressById(int $addressId)
Definition
addresscollection.php:41
Bitrix\Location\Entity\Address\AddressCollection\addItem
addItem($address)
Definition
addresscollection.php:25
Bitrix\Location\Entity\Address
Definition
address.php:22
Bitrix\Location\Entity\Generic\Collection
Definition
collection.php:12
Bitrix\Main\ArgumentTypeException
Definition
exception.php:114
Bitrix\Location\Entity\Address
Definition
addresscollection.php:3
modules
location
lib
entity
address
addresscollection.php
Создано системой
1.10.0