/** * {@inheritdoc} */ public function fullyLoadObject(IObject $object, $localization = ILocalesService::LOCALE_CURRENT) { if (!$object->getId()) { throw new LoadEntityException($this->translate('Cannot load object. Object id required.')); } $fieldsToLoad = []; $loadedValues = $object->getInitialValues(); foreach ($object->getType()->getFields() as $fieldName => $field) { if (!array_key_exists($fieldName, $loadedValues) || $localization === ILocalesService::LOCALE_ALL && $field->getIsLocalized()) { $fieldsToLoad[] = $fieldName; } } if (count($fieldsToLoad)) { $pkFiledName = $this->getIdentifyField()->getName(); $objectsSet = $this->select()->fields($fieldsToLoad)->localization($localization)->where($pkFiledName)->equals($object->getId())->result(); if (!$objectsSet->fetch()) { throw new LoadEntityException($this->translate('Cannot load object with id "{id}" from collection "{collection}".', ['id' => $object->getId(), 'collection' => $this->getName()])); } } }