/** * Возвращает класс для объекта коллекции. * @param ICollection $collection коллекция * @param IObjectType $objectType тип объекта * @return string */ private function getObjectClass(ICollection $collection, IObjectType $objectType) { if (null != ($objectClass = $objectType->getObjectClass())) { return $objectClass; } elseif ($collection instanceof IHierarchicCollection || $collection instanceof ICommonHierarchy) { return $this->defaultHierarchicObjectClass; } else { return $this->defaultObjectClass; } }
/** * {@inheritdoc} */ public function getProperty($propName, $localeId = null) { if ($this->isUnloaded) { throw new RuntimeException($this->translate('Cannot get property "{name}". Object "{class}" is unloaded.', ['name' => $propName, 'class' => __CLASS__])); } $fullPropName = $propName; $field = $this->type->getField($propName); if (!$localeId && $field->getIsLocalized()) { $loadLocalization = $this->getLoadLocalization(); $localeId = $loadLocalization === ILocalesService::LOCALE_CURRENT || $loadLocalization === ILocalesService::LOCALE_ALL ? $this->getCurrentDataLocale() : $loadLocalization; } if ($localeId) { $fullPropName .= IProperty::LOCALE_SEPARATOR . $localeId; } if (isset($this->properties[$fullPropName])) { return $this->properties[$fullPropName]; } if (!$this->hasProperty($propName, $localeId)) { throw new NonexistentEntityException($this->translate('Property "{name}" does not exist in "{type}".', ['name' => $fullPropName, 'type' => $this->getTypePath()])); } $property = $this->propertyFactory->createProperty($this, $field, $localeId); $this->initializeProperty($property); return $this->properties[$fullPropName] = $property; }