Horde_Kolab_Storage_Data_Base::getAttachment PHP Method

getAttachment() public method

Returns the specified attachment.
public getAttachment ( string $object_id, string $attachment_id ) : resource
$object_id string The object id. @since Kolab_Storage 2.1.0
$attachment_id string The attachment id.
return resource An open stream to the attachment data.
    public function getAttachment($object_id, $attachment_id)
    {
        foreach ($this->fetch($this->getStamp()->ids()) as $object) {
            if ($object->getBackendId() == $object_id && isset($object['_attachments'][$attachment_id])) {
                return $object['_attachments'][$attachment_id]['content'];
            }
        }
    }

Usage Example

コード例 #1
0
ファイル: Cached.php プロジェクト: Gomez/horde
 /**
  * Returns the specified attachment.
  *
  * @param string $object_id      The object id. @since Kolab_Storage 2.1.0
  * @param string $attachment_id  The attachment id.
  *
  * @return resource An open stream to the attachment data.
  */
 public function getAttachment($object_id, $attachment_id)
 {
     $this->_init();
     return $this->_data_cache->getAttachment($object_id, $attachment_id) ?: parent::getAttachment($object_id, $attachment_id);
 }