• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/orm/fields/objectfield.php
  • Класс: BitrixMainORMFieldsObjectField
  • Вызов: ObjectField::cast
public function cast($value)
{
	// try to check type
	if (!empty($this->objectClasses))
	{
		$foundClass = false;

		foreach ($this->objectClasses as $objectType)
		{
			if ($value instanceof $objectType)
			{
				$foundClass = true;
				break;
			}
		}

		if (!$foundClass)
		{
			trigger_error(sprintf(
					'Invalid value type `%s` for `%s` field',
					gettype($value) === 'object' ? get_class($value) : gettype($value),
					$this->entity->getFullName().':'.$this->name
				), E_USER_WARNING
			);
		}
	}

	return $value;
}