MetaModels\MetaModel::fetchTranslatedAttributeValues PHP Method

fetchTranslatedAttributeValues() protected method

This method is called to retrieve the data for certain items from the database.
protected fetchTranslatedAttributeValues ( MetaModels\Attribute\ITranslated $attribute, string[] $ids ) : array
$attribute MetaModels\Attribute\ITranslated The attribute to fetch the values for.
$ids string[] The ids of the items to retrieve the order of ids is used for sorting of the return values.
return array an array of all matched items, sorted by the id list.
    protected function fetchTranslatedAttributeValues(ITranslated $attribute, $ids)
    {
        $attributeData = $attribute->getTranslatedDataFor($ids, $this->getActiveLanguage());
        $missing = array_diff($ids, array_keys($attributeData));
        if ($missing) {
            $attributeData += $attribute->getTranslatedDataFor($missing, $this->getFallbackLanguage());
        }
        return $attributeData;
    }