Modules/Groupware/Files/File/Model/File.php

Show: inherited
Table of Contents

\Conjoon_Modules_Groupware_Files_File_Model_File

Package: Conjoon\Groupware\Files\Model

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

Propertyprotectedstring  $_name= ''groupware_files''

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

Default value'groupware_files'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
methodpublicaddFileToFolder( integer $folderId, string $name, resource | string $content, string $type, string $key, string $storageContainer = null ) : integer

Adds the given content to the file table.

Parameters
Name Type Description
$folderId integer
$name string
$content resource | string
$type string
$key string
$storageContainer string
Returns
Type Description
integer
Throws
Exception Description
\Conjoon_Data_Exception
Details
Deprecated
use addLob/addLobfromStream  
methodpublicaddLob( array $data ) : mixed

Saves the lob specified in $data The following properties must be available in $data: - groupwareFilesFoldersId - key - name - mimeType - resource - storageContainer

Parameters
Name Type Description
$data array
Returns
Type Description
mixed a unique identifier for this lob, or null
Throws
Exception Description
\Conjoon_Data_Exception
methodpublicaddLobFromStream( array $data ) : mixed

Adds the lob from a stream.

  • groupwareFilesFoldersId
  • key
  • name
  • mimeType
  • resource
  • storageContainer
Parameters
Name Type Description
$data array
Returns
Type Description
mixed a unique identifier for this lob, or null
Throws
Exception Description
\Conjoon_Data_Exception
Details
See
\isStreamWritingSupported  
methodpubliccopyLob( array $data ) : \id

Copies 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

Parameters
Name Type Description
$data array
Returns
Type Description
\id the id of the newly inserted row, or null if this was not successfull
Throws
Exception Description
\Conjoon_Data_Exception
methodpublicdeleteLob( array $data ) : bool

Deletes a lob.

The following properties need to be available in $data - id the id of the row

Parameters
Name Type Description
$data array
Returns
Type Description
bool true on success, otherwise false
Throws
Exception Description
\Conjoon_Data_Exception
methodpublicdeleteLobForId(  $id ) : bool

Deletes a lob for an id.

The following properties need to be available in $data - id the id of the row

Parameters
Name Type Description
$id
Returns
Type Description
bool true on success, otherwise false
Throws
Exception Description
\Conjoon_Data_Exception
methodpublicgetFileContentAsStreamForKeyAndId( string $key, integer $id ) : resource | null

Tries to return the contents from the file 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 | null
Throws
Exception Description
\Conjoon_Data_Exception
Details
Deprecated
use getLobAsStream  
methodpublicgetFileDataForKeyAndId( string $key, integer $id ) : array

Returns the file 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
\Conjoon_Data_Exception
Details
Deprecated
use getLobData  
methodpublicgetFileForKeyAndId( string $key, integer $id ) : array

Returns the file for the specified key and id plain, without creating resources or similiar.

Parameters
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.

Returns
Type Description
array
Throws
Exception Description
\Conjoon_Data_Exception
Details
Deprecated
use getLobData  
methodpublicgetLobAsStream( array $data ) : resource | null

Returns a stream resource for a lob.

  • id the id of the row
  • key the key of the row
Parameters
Name Type Description
$data array
Returns
Type Description
resource | null
Throws
Exception Description
\Conjoon_Data_Exception
Details
See
\isStreamAccessSupported  
methodpublicgetLobContent( array $data ) : string

Returns 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

Parameters
Name Type Description
$data array
Returns
Type Description
string
Throws
Exception Description
\Conjoon_Data_Exception
methodpublicgetLobData( array $data ) : array

Returns 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
Parameters
Name Type Description
$data array
Returns
Type Description
array or null if not exists
Throws
Exception Description
\Conjoon_Data_Exception
methodpublicgetTablePrefix( ) : String
staticinherited

Returns the table prefix.

Inherited from: \Conjoon_Db_Table::getTablePrefix()
Returns
Type Description
String
methodpublicisFileInFolderForUser( integer $id, integer $userId ) : boolean

Checks whether the specified file is accessible for the specified user.

Parameters
Name Type Description
$id integer
$userId integer
Returns
Type Description
boolean
Throws
Exception Description
\InvalidArgumentException
methodpublicisStreamAccessSupported( ) : bool

Returns true if this class is capable of returning a lob as a stream, otherwise false

Returns
Type Description
bool
methodpublicisStreamWritingSupported( ) : bool

Returns true if this class is capable of writing a lob as a stream, otherwise false

Returns
Type Description
bool
methodpublicmoveLob( array $data ) : integer

Moves 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

Parameters
Name Type Description
$data array
Returns
Type Description
integer the id of the lob which should equal to the id passed in the data array, otherwise null
Throws
Exception Description
\Conjoon_Data_Exception
methodpublicremoveFile( integer $id ) : integer

removes the row with the specified id.

Parameters
Name Type Description
$id integer
Returns
Type Description
integer The number of rows deleted
Throws
Exception Description
\Conjoon_Data_Exception
Details
Deprecated
use deleteLob instead  
methodpublicsetLobName( array $data ) : bool

Sets 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

Parameters
Name Type Description
$data array
Returns
Type Description
bool true on success, otherwise false
Throws
Exception Description
\Conjoon_Data_Exception
methodpublicsetTablePrefix( String $prefix ) : void
staticinherited

Sets the table prefix.

Inherited from: \Conjoon_Db_Table::setTablePrefix()
Parameters
Name Type Description
$prefix String
Documentation was generated by DocBlox 0.18.1.