Horde_Kolab_Storage_Cache_Data::getAttachmentByName PHP Method

getAttachmentByName() public method

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