30 protected $type = Type::UNKNOWN;
41 private $fieldCollection;
65 $candidateParents = $childCandidate->
getParents();
67 if(!$candidateParents)
72 return $candidateParents->isContain($this);
90 return $parents->isContain($parentCandidate);
101 if($this->
getId() > 0 && $location->
getId() > 0)
107 || $this->getSourceCode() !==
'' || $location->
getSourceCode() !==
'')
155 if($thisParents && $otherParents && !$thisParents->isEqualTo($otherParents))
170 return $this->parents;
179 if($this->parents ===
null)
181 $this->parents = Service\LocationService::getInstance()->findParents($this, $this->languageId);
214 $this->parents = $parents;
224 return $this->externalId;
233 $this->externalId = $externalId;
242 return $this->languageId;
251 $this->languageId = $languageId;
277 $result = $parent->getName().
', '.$this->
getName();
299 if($this->address ===
null)
301 $this->address = Location\Converter\AddressConverter::convertToAddress($this);
304 return $this->address;
313 $this->address = $address;
329 public function setId(
int $id): self
358 return $this->sourceCode;
388 if(!Type::isValueExist($type))
406 ->setCode($otherLocation->
getCode())
409 ->setType($otherLocation->
getType())
410 ->setName($otherLocation->
getName())
426 return $this->latitude;
435 $this->latitude = $latitude;
444 return $this->longitude;
453 $this->longitude = $longitude;
464 return Service\LocationService::getInstance()->save($this);
474 public static function load(
int $id,
string $languageId = LANGUAGE_ID)
476 return Service\LocationService::getInstance()->findById($id,
$languageId);
486 return Service\LocationService::getInstance()->delete($this);
503 return \Bitrix\Location\Entity\Location\Converter\ArrayConverter::convertToArray($this);
515 unserialize($serialized, [
'allowed_classes' =>
false])
536 return ArrayConverter::convertToArray($this);
541 return Json::encode($this->
toArray());
552 return ArrayConverter::convertFromArray($location);
565 if($field = $this->fieldCollection->getItemByType($type))
567 $field->setValue($value);
571 $this->fieldCollection->addItem(
572 new Field($type, $value)
588 foreach ($this->fieldCollection as $field)
590 $result[$field->getType()] = $field->getValue();
604 if($field = $this->fieldCollection->getItemByType($type))
606 $result = $field->getValue();
620 return (
bool)$this->fieldCollection->getItemByType($type);
629 return $this->fieldCollection;
setDescendant(Location $descendant)
setLatitude(string $latitude)
copyDataFrom(Location $otherLocation)
setExternalId(string $externalId)
__unserialize(array $data)
isChildOf(Location $parentCandidate)
setFieldValue(int $type, string $value)
setAddress(Address $address)
setLongitude(string $longitude)
isParentOf(Location $childCandidate)
setLanguageId(string $languageId)
static fromArray(array $location)
getParentByType(int $type)
static load(int $id, string $languageId=LANGUAGE_ID)
setParents(Parents $parents)
isEqualTo(Location $location)
getParentByLevel(int $level)
setSourceCode($sourceCode)