Users_Contact Class
Class representing 'Contact' rows in the 'Users' database You can create an object of this class either to access its non-static methods, or to actually represent a contact row in the Users database.
Item Index
Methods
- __set_state
- addContact static
- checkLabel static
- fetch static
- removeContact static
- setUp
- updateContact static
Events
Methods
__set_state
-
$array
Implements the __set_state method, so it can work with with var_export and be re-imported successfully.
Parameters:
-
$array
Array
Returns:
Class instance
addContact
-
$userId
-
$label
-
$contactUserId
-
[$nickname='']
-
[$asUserId=null]
-
boolean
Add contact with one or more labels
Parameters:
-
$userId
StringThe id of the user whose contact will be added
-
$label
String | ArrayThe label of the contact. This can be a string or an array of strings, in which case multiple contact rows are saved.
-
$contactUserId
StringThe id of the user who is the contact
-
[$nickname='']
String optionalOptional nickname to assign to the contact
-
[$asUserId=null]
String optionalThe user to do this operation as. Defaults to the logged-in user. Pass false to skip access checks.
-
boolean
Object[$unlessExists=false] If true, skips adding contact if it already exists in the database.
Returns:
Array of contacts that are saved
checkLabel
-
$userId
-
$label
-
$contactId
Check if a contact with this label exists
Parameters:
-
$userId
String -
$label
String -
$contactId
String
Returns:
fetch
-
$userId
-
$label
-
[$options=array()]
Retrieve contacts belonging to label
Parameters:
-
$userId
String -
$label
String | Array | Db_Range | Db_Expression -
[$options=array()]
Array optional-
[limit=false]
Integer optional -
[offset=0]
Integer optional -
[skipAccess]
Boolean optionalwhether to skip access checks
-
[asUserId]
String optionalthe user to do access checks as
-
[contactUserId=null]
String | Array optional
-
Returns:
removeContact
-
$userId
-
$label
-
$contactUserId
-
[$asUserId=null]
Remove contact from label
Parameters:
-
$userId
String -
$label
String -
$contactUserId
String -
[$asUserId=null]
String optionalThe user to do this operation as. Defaults to the logged-in user. Pass false to skip access checks.
Returns:
setUp
()
The setUp() method is called the first time an object of this class is constructed.
updateContact
-
$userId
-
$label
-
$contactUserId
-
$updates
-
[$asUserId=null]
Update a particular contact with a given userId, label, contactId.
Parameters:
-
$userId
String -
$label
String -
$contactUserId
String -
$updates
Arrayshould be an array with only one key: "nickname"
-
[$asUserId=null]
String optionalThe user to do this operation as. Defaults to the logged-in user. Pass false to skip access checks.
Returns:
Events
Users/Contact/addContact
After
Event Payload:
-
contactUserId
String -
label
String -
contacts
Array