- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/entitypropertyvalue.php
- Класс: BitrixSaleEntityPropertyValue
- Вызов: EntityPropertyValue::__construct
protected function __construct(array $property = null, array $value = [], array $relation = null)
{
if (!$property && !$value)
{
throw new MainSystemException('invalid arguments', 0, __FILE__, __LINE__);
}
if ($property)
{
if (is_array($property['SETTINGS']))
{
$property += $property['SETTINGS'];
unset ($property['SETTINGS']);
}
}
else
{
$property = [
'TYPE' => 'STRING',
'PROPS_GROUP_ID' => 0,
'NAME' => $value['NAME'],
'CODE' => $value['CODE'],
// defaults
'PERSON_TYPE_ID' => null,
'DESCRIPTION' => null,
'REQUIRED' => null,
'DEFAULT_VALUE' => null,
'SORT' => null,
'USER_PROPS' => null,
'IS_LOCATION' => 'N',
'IS_EMAIL' => 'N',
'IS_PROFILE_NAME' => 'N',
'IS_PAYER' => 'N',
'IS_LOCATION4TAX' => 'N',
'IS_FILTERED' => 'N',
'IS_ZIP' => 'N',
'IS_PHONE' => 'N',
'IS_ADDRESS' => 'N',
'IS_ADDRESS_FROM' => 'N',
'IS_ADDRESS_TO' => 'N',
'ACTIVE' => null,
'UTIL' => null,
'INPUT_FIELD_LOCATION' => null,
'MULTIPLE' => null,
];
}
$property['ENTITY_TYPE'] = static::getEntityType();
$propertyClassName = static::getPropertyClassName();
$this->property = new $propertyClassName($property, $relation);
if (isset($value['VALUE']))
{
$value['VALUE'] = $this->property->normalizeValue($value['VALUE']);
}
parent::__construct($value);
if (!$value)
{
$value = [
'ORDER_PROPS_ID' => $this->property->getId(),
'NAME' => $this->property->getName(),
'CODE' => $this->property->getField('CODE'),
'XML_ID' => static::generateXmlId(),
'ENTITY_TYPE' => $this->property->getField('ENTITY_TYPE')
];
if (!empty($this->property->getField('DEFAULT_VALUE')))
{
$value['VALUE'] = $this->property->getField('DEFAULT_VALUE');
}
$this->setFieldsNoDemand($value);
}
}