getAttachment() публичный Метод

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.
Результат resource An open stream to the attachment data.
Пример #1
0
 /**
  * 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)
 {
     return $this->_data->getAttachment($object_id, $attachment_id);
 }
Пример #2
0
 /**
  * Test storing attachments.
  *
  * @return NULL
  */
 public function testCacheAttachmentAsContent()
 {
     $data = new Horde_Kolab_Storage_Data('contact');
     $data->setFolder($this->folder);
     $object = array('uid' => '1', 'full-name' => 'User Name', 'email' => '*****@*****.**', 'inline-attachment' => array('test.txt'), '_attachments' => array('test.txt' => array('type' => 'text/plain', 'content' => 'test', 'name' => 'test.txt')));
     $result = $data->save($object);
     $this->assertNoError($result);
     $result = $data->getObject(1);
     $this->assertNoError($result);
     $this->assertTrue(isset($result['_attachments']['test.txt']));
     $this->assertEquals("test\r", $data->getAttachment($result['_attachments']['test.txt']['key']));
 }