protected function getItemsWithId($arrIds, $arrAttrOnly = array())
{
$arrIds = array_unique(array_filter($arrIds));
if (!$arrIds) {
return new Items(array());
}
if (!$arrAttrOnly) {
$arrAttrOnly = array_keys($this->getAttributes());
}
$arrResult = $this->fetchRows($arrIds, $arrAttrOnly);
// Give simple attributes the chance for editing the "simple" data.
foreach ($this->getSimpleAttributes() as $objAttribute) {
// Get current simple attribute.
$strColName = $objAttribute->getColName();
// Run each row.
foreach (array_keys($arrResult) as $intId) {
// Do only skip if the key does not exist. Do not use isset() here as "null" is a valid value.
if (!array_key_exists($strColName, $arrResult[$intId])) {
continue;
}
$value = $arrResult[$intId][$strColName];
$value2 = $objAttribute->unserializeData($arrResult[$intId][$strColName]);
// Deprecated fallback, attributes should deserialize themselves for a long time now.
if ($value === $value2) {
$value2 = $this->tryUnserialize($value);
if ($value !== $value2) {
trigger_error(sprintf('Attribute type %s should implement method unserializeData() and serializeData().', $objAttribute->get('type')), E_USER_DEPRECATED);
}
}
// End of deprecated fallback.
$arrResult[$intId][$strColName] = $value2;
}
}
// Determine "independent attributes" (complex and translated) and inject their content into the row.
$arrResult = $this->fetchAdditionalAttributes($arrIds, $arrResult, $arrAttrOnly);
$arrItems = array();
foreach ($arrResult as $arrEntry) {
$arrItems[] = new Item($this, $arrEntry);
}
$objItems = new Items($arrItems);
return $objItems;
}