Horde_Kolab_Storage_Cache_Data::getAttachmentByType PHP Method

getAttachmentByType() public method

Retrieves an attachment by name.
public getAttachmentByType ( string $obid, $type ) : array
$obid string Object backend id.
return array An array of attachment resources.
    public function getAttachmentByType($obid, $type)
    {
        $object = $this->getObjectByBackendId($obid);
        if (!isset($object['_attachments']['type'][$type])) {
            throw new Horde_Kolab_Storage_Exception(sprintf('No attachment with type "%s" for object id %s!', $type, $obid));
        }
        $result = array();
        foreach ($object['_attachments']['type'][$type] as $attachment_id) {
            $result[$attachment_id] = $this->_cache->loadAttachment($this->getDataId(), $obid, $attachment_id);
        }
        return $result;
    }