Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
shipmentpropertyvaluecollection.php
1<?php
2
3namespace Bitrix\Sale;
4
10{
12 protected $shipment;
13
18 protected static function getOnValueDeletedEventName(): string
19 {
20 return 'OnSaleShipmentPropertyValueDeleted';
21 }
22
27 protected static function getOnBeforeValueDeletedEventName(): string
28 {
29 return 'OnBeforeSaleShipmentPropertyValueDeleted';
30 }
31
35 protected static function getPropertyClassName(): string
36 {
37 $registry = Registry::getInstance(static::getRegistryType());
38 return $registry->getShipmentPropertyClassName();
39 }
40
44 protected function getEntityParent()
45 {
46 return $this->shipment;
47 }
48
52 protected static function getEntityType(): string
53 {
54 return \Bitrix\Sale\Registry::ENTITY_SHIPMENT;
55 }
56
61 protected static function getPropertyValueClassName(): string
62 {
63 $registry = Registry::getInstance(static::getRegistryType());
64 return $registry->getShipmentPropertyValueClassName();
65 }
66
72 public static function load(Shipment $shipment): ShipmentPropertyValueCollection
73 {
74 $propertyCollection = static::createPropertyValueCollectionObject();
75 $propertyCollection->setShipment($shipment);
76
78 $propertyValueClassName = static::getPropertyValueClassName();
79
80 $props = $propertyValueClassName::loadForEntity($shipment);
81
83 foreach ($props as $prop)
84 {
85 $prop->setCollection($propertyCollection);
86 $propertyCollection->addItem($prop);
87 }
88
89 return $propertyCollection;
90 }
91
95 public function getOrder()
96 {
97 return $this->shipment->getOrder();
98 }
99
100 private static function createPropertyValueCollectionObject()
101 {
102 $registry = Registry::getInstance(static::getRegistryType());
103 $propertyValueCollectionClassName = $registry->getShipmentPropertyValueCollectionClassName();
104 return new $propertyValueCollectionClassName();
105 }
106
110 protected function setShipment(Shipment $shipment)
111 {
112 $this->shipment = $shipment;
113 }
114}
static getInstance($type)
Definition registry.php:183