Modules/Groupware/Files/File/Model/File.php
\Conjoon_Modules_Groupware_Files_File_Model_File
Table data gateway. Models the table <tt>groupware_files</tt>.
- Parent(s)
- \Conjoon_Db_Table < \Conjoon_Data_LobAccess
- Author
- Thorsten Suckow-Homberg
- Category
- Model
- Uses
- \Conjoon_Db_Table
Properties

string
$_name= ''groupware_files''
The name of the table in the underlying datastore this class represents.
'groupware_files'Details- Type
- string

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

String
$_tblPrefix= '""'
""Details- Type
- String
- Inherited_from
- \Conjoon_Db_Table::$$_tblPrefix
Methods

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

addFileToFolder(
integer $folderId, string $name, resource | string $content, string $type, string $key, string $storageContainer
=
null
)
:
integerAdds the given content to the file table.
| Name | Type | Description |
|---|---|---|
| $folderId | integer | |
| $name | string | |
| $content | resource | string | |
| $type | string | |
| $key | string | |
| $storageContainer | string |
| Type | Description |
|---|---|
| integer |
| Exception | Description |
|---|---|
| \Conjoon_Data_Exception |
- Deprecated
- use addLob/addLobfromStream

addLob(
array $data
)
:
mixedSaves the lob specified in $data The following properties must be available in $data: - groupwareFilesFoldersId - key - name - mimeType - resource - storageContainer
| Name | Type | Description |
|---|---|---|
| $data | array |
| Type | Description |
|---|---|
| mixed | a unique identifier for this lob, or null |
| Exception | Description |
|---|---|
| \Conjoon_Data_Exception |

addLobFromStream(
array $data
)
:
mixedAdds the lob from a stream.
- groupwareFilesFoldersId
- key
- name
- mimeType
- resource
- storageContainer
| Name | Type | Description |
|---|---|---|
| $data | array |
| Type | Description |
|---|---|
| mixed | a unique identifier for this lob, or null |
| Exception | Description |
|---|---|
| \Conjoon_Data_Exception |
- See
- \isStreamWritingSupported

copyLob(
array $data
)
:
\idCopies a Lob.
The following properties have to be specified in $data - id The id of the row from which the row should be copied - key The key of the row that should be copied - newKey The new key for the copied row - name optional the new name for the lob - storageContainer optional a name for the storageContainer if not specified, the one from the original entry will be used - groupwareFilesFoldersId optional, the new folderId for the file. If not specified, the folder from the original entry will be used
| Name | Type | Description |
|---|---|---|
| $data | array |
| Type | Description |
|---|---|
| \id | the id of the newly inserted row, or null if this was not successfull |
| Exception | Description |
|---|---|
| \Conjoon_Data_Exception |

deleteLob(
array $data
)
:
boolDeletes a lob.
The following properties need to be available in $data - id the id of the row
| Name | Type | Description |
|---|---|---|
| $data | array |
| Type | Description |
|---|---|
| bool | true on success, otherwise false |
| Exception | Description |
|---|---|
| \Conjoon_Data_Exception |

deleteLobForId(
$id
)
:
boolDeletes a lob for an id.
The following properties need to be available in $data - id the id of the row
| Name | Type | Description |
|---|---|---|
| $id |
| Type | Description |
|---|---|
| bool | true on success, otherwise false |
| Exception | Description |
|---|---|
| \Conjoon_Data_Exception |

getFileContentAsStreamForKeyAndId(
string $key, integer $id
)
:
resource | nullTries to return the contents from the file as a stream. If that cannot be realized, the content will be returned as a string.
| Name | Type | Description |
|---|---|---|
| $key | string | |
| $id | integer |
| Type | Description |
|---|---|
| resource | null |
| Exception | Description |
|---|---|
| \Conjoon_Data_Exception |
- Deprecated
- use getLobAsStream

getFileDataForKeyAndId(
string $key, integer $id
)
:
arrayReturns the file data without the content for the specified key and id.
| Name | Type | Description |
|---|---|---|
| $key | string | |
| $id | integer |
| Type | Description |
|---|---|
| array |
| Exception | Description |
|---|---|
| \Conjoon_Data_Exception |
- Deprecated
- use getLobData

getFileForKeyAndId(
string $key, integer $id
)
:
arrayReturns the file for the specified key and id plain, without creating resources or similiar.
| Name | Type | Description |
|---|---|---|
| $key | string | The key of the file to query in the database. |
| $id | integer | The id of the file to query in the database. |
| Type | Description |
|---|---|
| array |
| Exception | Description |
|---|---|
| \Conjoon_Data_Exception |
- Deprecated
- use getLobData

getLobAsStream(
array $data
)
:
resource | nullReturns a stream resource for a lob.
- id the id of the row
- key the key of the row
| Name | Type | Description |
|---|---|---|
| $data | array |
| Type | Description |
|---|---|
| resource | null |
| Exception | Description |
|---|---|
| \Conjoon_Data_Exception |
- See
- \isStreamAccessSupported

getLobContent(
array $data
)
:
stringReturns the lob's content.
The following properties need to be available in $data - id the id of the row - key the key of the row
| Name | Type | Description |
|---|---|---|
| $data | array |
| Type | Description |
|---|---|
| string |
| Exception | Description |
|---|---|
| \Conjoon_Data_Exception |

getLobData(
array $data
)
:
arrayReturns the meta data for the lob.
- id the id of the row
- key the key of the row
- includeResource true to return the content. Content will be available in the "resource" property of the returned array
| Name | Type | Description |
|---|---|---|
| $data | array |
| Type | Description |
|---|---|
| array | or null if not exists |
| Exception | Description |
|---|---|
| \Conjoon_Data_Exception |

isFileInFolderForUser(
integer $id, integer $userId
)
:
booleanChecks whether the specified file is accessible for the specified user.
| Name | Type | Description |
|---|---|---|
| $id | integer | |
| $userId | integer |
| Type | Description |
|---|---|
| boolean |
| Exception | Description |
|---|---|
| \InvalidArgumentException |

isStreamAccessSupported(
)
:
boolReturns true if this class is capable of returning a lob as a stream, otherwise false
| Type | Description |
|---|---|
| bool |

isStreamWritingSupported(
)
:
boolReturns true if this class is capable of writing a lob as a stream, otherwise false
| Type | Description |
|---|---|
| bool |

moveLob(
array $data
)
:
integerMoves a Lob.
The following properties have to be specified in $data - id The id of the row from which the row should be moved - key The key of the row that should be moved - name optional the new name for the lob - groupwareFilesFoldersId the new folderId for the lob. If not specified, the folder from the original entry will be used - storageContainer optional a name for the storageContainer if not specified, the one from the original entry will be used
| Name | Type | Description |
|---|---|---|
| $data | array |
| Type | Description |
|---|---|
| integer | the id of the lob which should equal to the id passed in the data array, otherwise null |
| Exception | Description |
|---|---|
| \Conjoon_Data_Exception |

removeFile(
integer $id
)
:
integerremoves the row with the specified id.
| Name | Type | Description |
|---|---|---|
| $id | integer |
| Type | Description |
|---|---|
| integer | The number of rows deleted |
| Exception | Description |
|---|---|
| \Conjoon_Data_Exception |
- Deprecated
- use deleteLob instead

setLobName(
array $data
)
:
boolSets the name for a lob.
The following properties need to be available in $data - id the id of the row - key the key of the row - name The new name for the lob
| Name | Type | Description |
|---|---|---|
| $data | array |
| Type | Description |
|---|---|
| bool | true on success, otherwise false |
| Exception | Description |
|---|---|
| \Conjoon_Data_Exception |