Modules/Groupware/Email/Attachment/Model/Attachment.php

Show: inherited
Table of Contents

\Conjoon_Modules_Groupware_Email_Attachment_Model_Attachment

Package: Conjoon\Groupware\Email\Model

Table data gateway. Models the table <tt>groupware_email_items_attachments</tt>.

Parent(s)
\Conjoon_BeanContext_Decoratable < ?\Zend_Db_Table
Author
Thorsten Suckow-Homberg  
Category
Model  
Uses
\Conjoon_Db_Table  

Properties

Propertyprotectedstring  $_name= ''groupware_email_items_attachments''

The name of the table in the underlying datastore this class represents.

Default value'groupware_email_items_attachments'Details
Type
string
Propertyprotectedstring  $_primary= ''id''

The name of the column that denotes the primary key for this table

Default value'id'Details
Type
string
PropertyprotectedString  $_tblPrefix= '""'
staticinherited

Default table prefix.

Inherited from: \Conjoon_Db_Table::$$_tblPrefix
Default value""Details
Type
String
Inherited_from
\Conjoon_Db_Table::$$_tblPrefix  

Methods

methodpublic__construct( string | array $config = array(), \unknown_type $definition = null ) : void
inherited

__construct() - For concrete implementation of Conjoon_Db_Table

Inherited from: \Conjoon_Db_Table::__construct()

This constructor automatically prepends the prefix as defined using setTablePrefix() to this table's name.

Parameters
Name Type Description
$config string | array

string can reference a Zend_Registry key for a db adapter OR it can refernece the name of a table

$definition \unknown_type
methodpublicaddAttachmentForItem( array $data,  $itemId ) : integer

Adds an attachment to this table.

Parameters
Name Type Description
$data array
$itemId
Returns
Type Description
integer
Throws
Exception Description
\InvalidArgumentException
\Conjoon_Exception
methodpubliccopyAttachmentForNewItemId( integer $attachmentId, \$integer $itemId, string $name = null ) : integer

Copies an attachment entry and saves it for a new item id.

If the name was supplied, the attachment will also be stored under the new name.

Parameters
Name Type Description
$attachmentId integer
$itemId \$integer
$name string
Returns
Type Description
integer The id of teh last inserted id, or 0
Throws
Exception Description
\InvalidArgumentException
\Conjoon_Exception
methodpubliccopyFromFilesForItemId( string $key, integer $id, integer $itemId, string $name = null ) : integer

Copies a file from the file table to the attachment table.

The content will be stored as base64 encoded.

Parameters
Name Type Description
$key string

The key from the file to copy to the attachments table

$id integer

The id of the file to copy to the attachment table

$itemId integer

the id of the email item for which the file gets copied

$name string

optional, the new name to store newly created attachment under

Returns
Type Description
integer The id of the newly created row, or 0
Throws
Exception Description
\InvalidArgumentException
\Conjoon_Exception
methodpublicdeleteAttachmentForId( integer $id ) : integer

Deletes an attachment with the specified id.

Parameters
Name Type Description
$id integer

The id of the attachment

Returns
Type Description
integer
Throws
Exception Description
\InvalidArgumentException
methodpublicgetAttachmentContentAsStreamForKeyAndId( string $key, integer $id ) : resource | string

Tries to return the contents from the attachment as a stream. If that cannot be realized, the content will be returned as a string.

Parameters
Name Type Description
$key string
$id integer
Returns
Type Description
resource | string
Throws
Exception Description
\InvalidArgumentException
\Conjoon_Exception
methodpublicgetAttachmentDataForKeyAndId( string $key, integer $id ) : array

Returns the attachment data without the content for the specified key and id.

Parameters
Name Type Description
$key string
$id integer
Returns
Type Description
array
Throws
Exception Description
\InvalidArgumentException
methodpublicgetAttachmentForId( integer $id ) : array

Returns the attachment for the specified id.

This method should only be used when its clear that the attachment for the specified id belongs to the user the attachment gets read out for.

Parameters
Name Type Description
$id integer

The id of the attachment to query in the database.

Returns
Type Description
array
Throws
Exception Description
\InvalidArgumentException
methodpublicgetAttachmentForKeyAndId( string $key, integer $id ) : array

Returns the attachment for the specified key and id.

Parameters
Name Type Description
$key string

The key of the attachment to query in the database.

$id integer

The id of the attachment to query in the database.

Returns
Type Description
array
Throws
Exception Description
\InvalidArgumentException
methodpublicgetAttachmentsForItem(  $groupwareEmailItemsId ) : \Zend_Db_Table_Rowset

Returns all the attachments for the specified item.

Parameters
Name Type Description
$groupwareEmailItemsId
Returns
Type Description
\Zend_Db_Table_Rowset
methodpublicgetDecoratableMethods( ) : void

methodpublicgetEmailItemIdForAttachmentKeyAndId( string $key, integer $id ) : integer

Returns the email item id for the specified attachment key and id.

Note: If the attachment was not found, this method will return "0"!

Parameters
Name Type Description
$key string

The key of the attachment to query in the database.

$id integer

The id of the attachment to query in the database.

Returns
Type Description
integer
Throws
Exception Description
\InvalidArgumentException
methodpublicgetRepresentedEntity( ) : void

methodpublicgetTablePrefix( ) : String
staticinherited

Returns the table prefix.

Inherited from: \Conjoon_Db_Table::getTablePrefix()
Returns
Type Description
String
methodpublicsetTablePrefix( String $prefix ) : void
staticinherited

Sets the table prefix.

Inherited from: \Conjoon_Db_Table::setTablePrefix()
Parameters
Name Type Description
$prefix String
methodpublicupdateNameForAttachment( integer $id, string $name ) : int

Updates the name for a given attachment

Parameters
Name Type Description
$id integer
$name string
Returns
Type Description
int
Throws
Exception Description
\InvalidArgumentException
Documentation was generated by DocBlox 0.18.1.