Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
PropertyFeatureRepository.php
1
<?php
2
3
namespace
Bitrix\Catalog\v2\PropertyFeature
;
4
5
use
Bitrix\Catalog\v2\BaseEntity
;
6
use
Bitrix\Catalog\v2\Property\Property
;
7
use
Bitrix\Iblock\PropertyFeatureTable
;
8
use
Bitrix\Main\Result
;
9
18
class
PropertyFeatureRepository
implements
PropertyFeatureRepositoryContract
19
{
21
protected
$factory
;
22
23
public
function
__construct
(
PropertyFeatureFactory
$factory
)
24
{
25
$this->factory =
$factory
;
26
}
27
28
public
function
getEntityById
(
int
$id)
29
{
30
return
$this->
getEntitiesBy
([
31
'filter'
=> [
'=ID'
=> $id],
32
'limit'
=> 1,
33
]);
34
}
35
36
public
function
getEntitiesBy
($params)
37
{
38
return
PropertyFeatureTable::getList($params)->fetchAll();
39
}
40
41
public
function
save
(
BaseEntity
...$entities):
Result
42
{
43
return
new
Result
();
44
}
45
46
public
function
delete
(
BaseEntity
...$entities):
Result
47
{
48
return
new
Result
();
49
}
50
51
public
function
getCollectionByParent
(
Property
$entity):
PropertyFeatureCollection
52
{
53
$collection = $this->factory->createCollection();
54
55
$featureSettings = $this->
getEntitiesBy
([
56
'filter'
=> [
'=PROPERTY_ID'
=> $entity->
getId
()],
57
]);
58
59
foreach
($featureSettings as $settings)
60
{
61
$feature = $this->
createEntity
();
62
$feature->setSettings($settings);
63
$collection->add($feature);
64
}
65
66
return
$collection;
67
}
68
69
protected
function
createEntity
(array $fields = []):
PropertyFeature
70
{
71
$entity = $this->factory->createEntity();
72
73
$entity->
initFields
($fields);
74
75
return
$entity;
76
}
77
}
Bitrix\Catalog\v2\BaseEntity
Definition
BaseEntity.php:22
Bitrix\Catalog\v2\BaseEntity\initFields
initFields(array $fields)
Definition
BaseEntity.php:63
Bitrix\Catalog\v2\Property\Property
Definition
Property.php:26
Bitrix\Catalog\v2\Property\Property\getId
getId()
Definition
Property.php:91
Bitrix\Catalog\v2\PropertyFeature\PropertyFeatureCollection
Definition
PropertyFeatureCollection.php:17
Bitrix\Catalog\v2\PropertyFeature\PropertyFeatureFactory
Definition
PropertyFeatureFactory.php:16
Bitrix\Catalog\v2\PropertyFeature\PropertyFeature
Definition
PropertyFeature.php:17
Bitrix\Catalog\v2\PropertyFeature\PropertyFeatureRepository
Definition
PropertyFeatureRepository.php:19
Bitrix\Catalog\v2\PropertyFeature\PropertyFeatureRepository\$factory
$factory
Definition
PropertyFeatureRepository.php:21
Bitrix\Catalog\v2\PropertyFeature\PropertyFeatureRepository\getCollectionByParent
getCollectionByParent(Property $entity)
Definition
PropertyFeatureRepository.php:51
Bitrix\Catalog\v2\PropertyFeature\PropertyFeatureRepository\getEntitiesBy
getEntitiesBy($params)
Definition
PropertyFeatureRepository.php:36
Bitrix\Catalog\v2\PropertyFeature\PropertyFeatureRepository\save
save(BaseEntity ... $entities)
Definition
PropertyFeatureRepository.php:41
Bitrix\Catalog\v2\PropertyFeature\PropertyFeatureRepository\getEntityById
getEntityById(int $id)
Definition
PropertyFeatureRepository.php:28
Bitrix\Catalog\v2\PropertyFeature\PropertyFeatureRepository\createEntity
createEntity(array $fields=[])
Definition
PropertyFeatureRepository.php:69
Bitrix\Catalog\v2\PropertyFeature\PropertyFeatureRepository\__construct
__construct(PropertyFeatureFactory $factory)
Definition
PropertyFeatureRepository.php:23
Bitrix\Iblock\PropertyFeatureTable
Definition
propertyfeature.php:40
Bitrix\Main\ORM\Data\Result
Definition
result.php:16
Bitrix\Main\Result
Definition
result.php:14
Bitrix\Catalog\v2\PropertyFeature\PropertyFeatureRepositoryContract
Definition
PropertyFeatureRepositoryContract.php:17
Bitrix\Catalog\v2\PropertyFeature
Definition
HasPropertyFeatureCollection.php:3
modules
catalog
lib
v2
PropertyFeature
PropertyFeatureRepository.php
Создано системой
1.10.0