protected function fetchAdditionalAttributes($ids, $result, $attrOnly = array())
{
$attributes = $this->getAttributeByNames($attrOnly);
$attributeNames = array_intersect(array_keys($attributes), array_keys(array_merge($this->getComplexAttributes(), $this->getTranslatedAttributes())));
foreach ($attributeNames as $attributeName) {
$attribute = $attributes[$attributeName];
/** @var IAttribute $attribute */
$attributeName = $attribute->getColName();
// If it is translated, fetch the translated data now.
if ($this->isTranslatedAttribute($attribute)) {
/** @var ITranslated $attribute */
$attributeData = $this->fetchTranslatedAttributeValues($attribute, $ids);
} else {
/** @var IComplex $attribute */
$attributeData = $attribute->getDataFor($ids);
}
foreach (array_keys($result) as $id) {
$result[$id][$attributeName] = isset($attributeData[$id]) ? $attributeData[$id] : null;
}
}
return $result;
}