/**
* Retrieves the objects for the given UIDs.
*
* @param array $uids The message UIDs.
* @param boolean $raw True if the raw format should be returned rather than
* the parsed data.
*
* @return array An array of objects.
* @throws new Horde_Kolab_Storage_Exception
*/
public function fetch($uids, $raw = false)
{
if (empty($uids)) {
return array();
}
if ($raw === false) {
$writer = new Horde_Kolab_Storage_Object_Writer_Format(new Horde_Kolab_Format_Factory(), array('version' => $this->_version));
} else {
$writer = new Horde_Kolab_Storage_Object_Writer_Raw();
}
$objects = array();
$structures = $this->_driver->fetchStructure($this->_folder->getPath(), $uids);
foreach ($structures as $uid => $structure) {
if (!isset($structure['structure'])) {
throw new Horde_Kolab_Storage_Exception('Backend returned a structure without the expected "structure" element.');
}
$object = new Horde_Kolab_Storage_Object();
$object->setDriver($this->_driver);
$object->load($uid, $this->_folder, $writer, $structure['structure']);
$objects[$uid] = $object;
}
return $objects;
}