1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
propertytofield.php
См. документацию.
1<?php
8
9namespace Bitrix\Iblock\ORM;
10
11use Bitrix\Iblock\Iblock;
12use Bitrix\Iblock\Property;
13use Bitrix\Iblock\PropertyEnumerationTable;
14use Bitrix\Iblock\PropertyTable;
15use Bitrix\Iblock\SectionTable;
16use Bitrix\Main\FileTable;
17use Bitrix\Main\ORM\Entity;
18use Bitrix\Main\ORM\Fields\FloatField;
19use Bitrix\Main\ORM\Fields\IntegerField;
20use Bitrix\Main\ORM\Fields\Relations\Reference;
21use Bitrix\Main\ORM\Fields\StringField;
22use Bitrix\Main\ORM\Query\Join;
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)
Определения propertytofield.php:38
const TYPE_ELEMENT
Определения propertytable.php:68
const TYPE_FILE
Определения propertytable.php:67
const TYPE_STRING
Определения propertytable.php:65
const TYPE_LIST
Определения propertytable.php:70
const TYPE_SECTION
Определения propertytable.php:69
const TYPE_NUMBER
Определения propertytable.php:66
static wakeUp($rows)
Определения collection.php:471