GlobalConstTable :: upsertByProperty: Bitrix method

      
<?php 
//  Bitrix\Bizproc\Workflow\Type\Entity\GlobalConstTable :: upsertByProperty()
//  /dist/bitrix/modules/bizproc/lib/workflow/type/entity/globalconst.php:67

    
public static function upsertByProperty($constId, array $property)
    {
        
$property FieldType::normalizeProperty($property);

        
$fields = [
            
'NAME' => $property['Name'],
            
'DESCRIPTION' => $property['Description'],
            
'PROPERTY_TYPE' => $property['Type'],
            
'IS_REQUIRED' => $property['Required'] ? 'Y' 'N',
            
'IS_MULTIPLE' => $property['Multiple'] ? 'Y' 'N',
            
'PROPERTY_OPTIONS' => $property['Options'],
            
'PROPERTY_VALUE' => $property['Default'],
        ];

        
$count = static::getCount(['=ID' => $constId]);
        if (
$count 0)
        {
            
$result = static::update($constId$fields);
        }
        else
        {
            
$result = static::add($fields + ['ID' => $constId]);
        }

        return 
$result;
    }