Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
SimpleSku.php
1<?php
2
4
12
21class 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
48 {
49 return $this->getParent()->getPropertyCollection();
50 }
51
53 {
54 if ($parent = $this->getParent())
55 {
56 $parent->unsetPropertyCollection();
57 }
58
59 return parent::unsetPropertyCollection();
60 }
61
66 {
67 return $this->getParent()->getImageCollection();
68 }
69
71 {
72 if ($parent = $this->getParent())
73 {
74 $parent->unsetImageCollection();
75 }
76
77 return parent::unsetImageCollection();
78 }
79
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}
getChildCollections(bool $initCollections=false)
setPropertyCollection(PropertyCollection $propertyCollection)
Definition SimpleSku.php:80