Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
propertytofield.php
1<?php
9namespace Bitrix\Iblock\ORM;
10
23
31{
38 public static function attachField($property, $propertyValueEntity)
39 {
40 switch ($property->getPropertyType())
41 {
43
44 $propertyValueEntity->addField(new StringField('VALUE'));
45 break;
46
48
49 $propertyValueEntity->addField(new FloatField('VALUE'));
50 break;
51
53
54 $propertyValueEntity->addField(new IntegerField('VALUE'));
55
56 // add reference to file
57 $propertyValueEntity->addField(new Reference(
58 'FILE', FileTable::class,
59 Join::on("this.VALUE", 'ref.ID')
60 ));
61 break;
62
64
65 $propertyValueEntity->addField(new IntegerField('VALUE'));
66
67 // add reference to element
68 $refIblock = Iblock::wakeUp($property->getLinkIblockId());
69 $refIblock->fill('API_CODE');
70
71 if($refIblock->getApiCode() <> '')
72 {
73 $refEntityName = $refIblock->getEntityDataClass();
74
75 $propertyValueEntity->addField(
76 new Reference('ELEMENT', $refEntityName, Join::on("this.VALUE", 'ref.ID'))
77 );
78 }
79 break;
80
82
83 $propertyValueEntity->addField(new IntegerField('VALUE'));
84
85 // add reference to section
86 $propertyValueEntity->addField(new Reference(
87 'SECTION', SectionTable::class,
88 Join::on("this.VALUE", 'ref.ID')
89 ));
90 break;
91
93
94 $propertyValueEntity->addField(new IntegerField('VALUE'));
95
96 // add reference to list item
97 $propertyValueEntity->addField(new Reference(
98 'ITEM',
99 PropertyEnumerationTable::class,
100 Join::on('this.VALUE', 'ref.ID')
101 ));
102 break;
103 }
104 }
105}
static attachField($property, $propertyValueEntity)