Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
SimpleSku.php
1
<?php
2
3
namespace
Bitrix\Catalog\v2\Sku
;
4
5
use
Bitrix\Catalog\v2\BaseEntity
;
6
use
Bitrix\Catalog\v2\BaseIblockElementEntity
;
7
use
Bitrix\Catalog\v2\Fields\FieldStorage
;
8
use
Bitrix\Catalog\v2\Image\ImageCollection
;
9
use
Bitrix\Catalog\v2\Property\PropertyCollection
;
10
use
Bitrix\Main\NotSupportedException
;
11
use
Bitrix\Main\Result
;
12
21
class
SimpleSku
extends
BaseSku
22
{
27
public
function
getParent
():
BaseEntity
28
{
29
$parent = parent::getParent();
30
31
if
(!$parent)
32
{
33
throw
new
NotSupportedException
(sprintf(
'{%s} must have a parent.'
, static::class));
34
}
35
36
return
$parent;
37
}
38
39
protected
function
createFieldStorage
():
FieldStorage
40
{
41
return
$this->
getParent
()->getFieldStorage();
42
}
43
47
protected
function
loadPropertyCollection
():
PropertyCollection
48
{
49
return
$this->
getParent
()->getPropertyCollection();
50
}
51
52
protected
function
unsetPropertyCollection
():
BaseIblockElementEntity
53
{
54
if
($parent = $this->
getParent
())
55
{
56
$parent->
unsetPropertyCollection
();
57
}
58
59
return
parent::unsetPropertyCollection();
60
}
61
65
protected
function
loadImageCollection
():
ImageCollection
66
{
67
return
$this->
getParent
()->getImageCollection();
68
}
69
70
protected
function
unsetImageCollection
():
BaseIblockElementEntity
71
{
72
if
($parent = $this->
getParent
())
73
{
74
$parent->
unsetImageCollection
();
75
}
76
77
return
parent::unsetImageCollection();
78
}
79
80
public
function
setPropertyCollection
(
PropertyCollection
$propertyCollection
):
BaseIblockElementEntity
81
{
82
// avoiding reinitialize of property collection with our simple sku parent
83
$this->propertyCollection =
$propertyCollection
;
84
85
return
$this;
86
}
87
88
public
function
deleteInternal
():
Result
89
{
90
$result =
new
Result
();
91
92
// delete child collections without entity fields itself (it was deleted with parent product entity)
93
foreach
($this->
getChildCollections
(
true
) as $childCollection)
94
{
95
$res = $childCollection->deleteInternal();
96
97
if
(!$res->isSuccess())
98
{
99
$result->addErrors($res->getErrors());
100
}
101
}
102
103
return
$result;
104
}
105
}
Bitrix\Catalog\v2\BaseEntity
Definition
BaseEntity.php:22
Bitrix\Catalog\v2\BaseEntity\getChildCollections
getChildCollections(bool $initCollections=false)
Definition
BaseEntity.php:306
Bitrix\Catalog\v2\BaseIblockElementEntity
Definition
BaseIblockElementEntity.php:27
Bitrix\Catalog\v2\BaseIblockElementEntity\$propertyCollection
$propertyCollection
Definition
BaseIblockElementEntity.php:33
Bitrix\Catalog\v2\BaseIblockElementEntity\unsetImageCollection
unsetImageCollection()
Definition
BaseIblockElementEntity.php:162
Bitrix\Catalog\v2\BaseIblockElementEntity\unsetPropertyCollection
unsetPropertyCollection()
Definition
BaseIblockElementEntity.php:102
Bitrix\Catalog\v2\Fields\FieldStorage
Definition
FieldStorage.php:17
Bitrix\Catalog\v2\Image\ImageCollection
Definition
ImageCollection.php:17
Bitrix\Catalog\v2\Property\PropertyCollection
Definition
PropertyCollection.php:17
Bitrix\Catalog\v2\Sku\BaseSku
Definition
BaseSku.php:34
Bitrix\Catalog\v2\Sku\SimpleSku
Definition
SimpleSku.php:22
Bitrix\Catalog\v2\Sku\SimpleSku\loadPropertyCollection
loadPropertyCollection()
Definition
SimpleSku.php:47
Bitrix\Catalog\v2\Sku\SimpleSku\loadImageCollection
loadImageCollection()
Definition
SimpleSku.php:65
Bitrix\Catalog\v2\Sku\SimpleSku\createFieldStorage
createFieldStorage()
Definition
SimpleSku.php:39
Bitrix\Catalog\v2\Sku\SimpleSku\unsetImageCollection
unsetImageCollection()
Definition
SimpleSku.php:70
Bitrix\Catalog\v2\Sku\SimpleSku\deleteInternal
deleteInternal()
Definition
SimpleSku.php:88
Bitrix\Catalog\v2\Sku\SimpleSku\setPropertyCollection
setPropertyCollection(PropertyCollection $propertyCollection)
Definition
SimpleSku.php:80
Bitrix\Catalog\v2\Sku\SimpleSku\getParent
getParent()
Definition
SimpleSku.php:27
Bitrix\Catalog\v2\Sku\SimpleSku\unsetPropertyCollection
unsetPropertyCollection()
Definition
SimpleSku.php:52
Bitrix\Main\NotSupportedException
Definition
exception.php:159
Bitrix\Main\ORM\Data\Result
Definition
result.php:16
Bitrix\Main\Result
Definition
result.php:14
Bitrix\Catalog\v2\Sku
Definition
BaseSku.php:3
modules
catalog
lib
v2
Sku
SimpleSku.php
Создано системой
1.10.0