Modules/Groupware/Email/Account/Model/Account.php

Show: inherited
Table of Contents

\Conjoon_Modules_Groupware_Email_Account_Model_Account

Package: Conjoon\Groupware\Email\Model

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

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

Properties

Propertyprotectedstring  $_name= ''groupware_email_accounts''

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

Default value'groupware_email_accounts'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
methodprivate_removeInformationForAccountIf(  $accountId,  $userId ) : void

Parameters
Name Type Description
$accountId
$userId
methodpublicaddAccount( integer $userId, array $data ) : integer

Adds an account for the specified user with the specified data.

Parameters
Name Type Description
$userId integer

The userid this account will belong to

$data array

an assoc array with keys as fields and values as data to add Will also take the default folder of the user and copy them so emails for this account will also be stored in this folders.

Returns
Type Description
integer 0 if the data wasn't added, otherwise the id of the newly added row
methodpublicdeleteAccount( integer $accountId, integer $userId ) : integer

Sets the is_deleted flag of the account to "0", which basically means that this account is not active anymore. However, in order for older email items to still work properly, folder mappings have to remain, until no item for this account is found in the database. After that, the account may be removed entirely.

Parameters
Name Type Description
$accountId integer
$userId integer
Returns
Type Description
integer The number of accounts deleted.
methodpublicgetAccount(  $accountId, int $userId ) : \Zend_Db_Table_Rowset

Returns the account with the specified id for the specified user

Parameters
Name Type Description
$accountId
$userId int

The id of the user to whom the specified account belongs

Returns
Type Description
\Zend_Db_Table_Rowset
methodpublicgetAccountWithNameForUser( string $name, int $userId ) : array

Returns the accounts with the specified name for the specified user Returns an empty array if no accounts with this name could be found.

Parameters
Name Type Description
$name string

The name of the accounts to query

$userId int

The id of the user to whom the specified accounts belongs

Returns
Type Description
array
Throws
Exception Description
\Conjoon_Argument_Exception
methodpublicgetAccountsForUser( int $id ) : \Zend_Db_Table_Rowset

Returns all email accounts for the specified user-id.

Note, that the field 'user_id' won't be available in the returned array.

Parameters
Name Type Description
$id int

The id of the user to get the email accounts for

Returns
Type Description
\Zend_Db_Table_Rowset
methodpublicgetDecoratableMethods( ) : void

methodpublicgetEmailAddressesForUser( int $id ) : array

Returns all email addresses which are configured for a user.

This takes also reply-addresses into account.

Parameters
Name Type Description
$id int

The id of the user to get the email addresses for

Returns
Type Description
array A numeric array with all email addresses found in the accounts from the user
methodpublicgetRepresentedEntity( ) : void

methodpublicgetStandardAccountIdForUser(  $userId ) : integer

Returns the id of the standard account for this user. If no standard account could be found, any other account id will be returned.

If no account was found, 0 will be returned.

Parameters
Name Type Description
$userId
Returns
Type Description
integer
methodpublicgetTablePrefix( ) : String
staticinherited

Returns the table prefix.

Inherited from: \Conjoon_Db_Table::getTablePrefix()
Returns
Type Description
String
methodpublicremoveAsDeletedFlaggedAccounts( integer $userId ) : array

Removes any account which is flagged as "is_deleted=1" along with its informations, if there are no items for this account in the related folders anymore.

Parameters
Name Type Description
$userId integer
Returns
Type Description
array An array with the deleted account ids
methodpublicsetTablePrefix( String $prefix ) : void
staticinherited

Sets the table prefix.

Inherited from: \Conjoon_Db_Table::setTablePrefix()
Parameters
Name Type Description
$prefix String
methodpublicupdateAccount( integer $id, array $data ) : integer

Updates an account with the specified data.

Parameters
Name Type Description
$id integer

The id of the account to update

$data array

an assoc array with keys as fields and values as data to update

Returns
Type Description
integer The number of rows updated. If any input error happened, -1 will be returned. 0 will be returned, if the data was not changed, i.e. if the row equaled to teh data tried to update. 1 will be returned if any changes to the data has been made.
Documentation was generated by DocBlox 0.18.1.