Modules/Groupware/Email/Attachment/Model/Attachment.php
\Conjoon_Modules_Groupware_Email_Attachment_Model_Attachment
Package: Conjoon\Groupware\Email\ModelTable 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



string
$_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



string
$_primary= ''id''
The name of the column that denotes the primary key for this table
Default value'id'Details
- Type
- string
Methods



__construct(
string | array $config
=
array(), \unknown_type $definition
=
null
)
:
void
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 |
|



addAttachmentForItem(
array $data, $itemId
)
:
integerAdds an attachment to this table.
Parameters
| Name |
Type |
Description |
| $data |
array |
|
| $itemId |
|
|
Returns
Throws



copyAttachmentForNewItemId(
integer $attachmentId, \$integer $itemId, string $name
=
null
)
:
integerCopies 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



copyFromFilesForItemId(
string $key, integer $id, integer $itemId, string $name
=
null
)
:
integerCopies 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



deleteAttachmentForId(
integer $id
)
:
integerDeletes an attachment with the specified id.
Parameters
| Name |
Type |
Description |
| $id |
integer |
The id of the attachment |
Returns
Throws



getAttachmentContentAsStreamForKeyAndId(
string $key, integer $id
)
:
resource | stringTries 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



getAttachmentDataForKeyAndId(
string $key, integer $id
)
:
arrayReturns the attachment data without the content for the specified key
and id.
Parameters
| Name |
Type |
Description |
| $key |
string |
|
| $id |
integer |
|
Returns
Throws



getAttachmentForId(
integer $id
)
:
arrayReturns 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
Throws



getAttachmentForKeyAndId(
string $key, integer $id
)
:
arrayReturns 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
Throws



getAttachmentsForItem(
$groupwareEmailItemsId
)
:
\Zend_Db_Table_RowsetReturns all the attachments for the specified item.
Parameters
| Name |
Type |
Description |
| $groupwareEmailItemsId |
|
|
Returns
| Type |
Description |
| \Zend_Db_Table_Rowset |
|



getEmailItemIdForAttachmentKeyAndId(
string $key, integer $id
)
:
integerReturns 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
Throws



updateNameForAttachment(
integer $id, string $name
)
:
intUpdates the name for a given attachment
Parameters
| Name |
Type |
Description |
| $id |
integer |
|
| $name |
string |
|
Returns
Throws