• Модуль: location
  • Путь к файлу: ~/bitrix/modules/location/lib/entity/location.php
  • Класс: BitrixLocationEntityLocation
  • Вызов: Location::isEqualTo
public function isEqualTo(Location $location): bool
{
	if($this->getId() > 0 && $location->getId() > 0)
	{
		return $this->getId() === $location->getId();
	}

	if($this->getExternalId() !== '' || $location->getExternalId() !== ''
		|| $this->getSourceCode() !== '' || $location->getSourceCode() !== '')
	{

		if($this->getExternalId() === $location->getExternalId()
			&& $this->getSourceCode() === $location->getSourceCode())
		{
			return true;
		}

		if($this->getExternalId() !== $location->getExternalId())
		{
			return false;
		}

		if($this->getSourceCode() !== $location->getSourceCode())
		{
			return false;
		}
	}

	if($this->getType() !== $location->getType())
	{
		return false;
	}

	if($this->getLanguageId() !== $location->getLanguageId())
	{
		return false;
	}

	if($this->getName() !== $location->getName())
	{
		return false;
	}

	if($this->getLatitude() !== $location->getLatitude())
	{
		return false;
	}

	if($this->getLongitude() !== $location->getLongitude())
	{
		return false;
	}

	$thisParents = $this->getParents();
	$otherParents = $location->getParents();

	if($thisParents && $otherParents && !$thisParents->isEqualTo($otherParents))
	{
		return false;
	}

	return true;
}