comparison core/modules/user/src/UserDataInterface.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\user;
4
5 /**
6 * Defines the user data service interface.
7 */
8 interface UserDataInterface {
9
10 /**
11 * Returns data stored for a user account.
12 *
13 * @param string $module
14 * The name of the module the data is associated with.
15 * @param int $uid
16 * (optional) The user account ID the data is associated with.
17 * @param string $name
18 * (optional) The name of the data key.
19 *
20 * @return mixed|array
21 * The requested user account data, depending on the arguments passed:
22 * - For $module, $name, and $uid, the stored value is returned, or NULL if
23 * no value was found.
24 * - For $module and $uid, an associative array is returned that contains
25 * the stored data name/value pairs.
26 * - For $module and $name, an associative array is returned whose keys are
27 * user IDs and whose values contain the stored values.
28 * - For $module only, an associative array is returned that contains all
29 * existing data for $module in all user accounts, keyed first by user ID
30 * and $name second.
31 */
32 public function get($module, $uid = NULL, $name = NULL);
33
34 /**
35 * Stores data for a user account.
36 *
37 * @param string $module
38 * The name of the module the data is associated with.
39 * @param int $uid
40 * The user account ID the data is associated with.
41 * @param string $name
42 * The name of the data key.
43 * @param mixed $value
44 * The value to store. Non-scalar values are serialized automatically.
45 */
46 public function set($module, $uid, $name, $value);
47
48 /**
49 * Deletes data stored for a user account.
50 *
51 * @param string|array $module
52 * (optional) The name of the module the data is associated with. Can also
53 * be an array to delete the data of multiple modules.
54 * @param int|array $uid
55 * (optional) The user account ID the data is associated with. If omitted,
56 * all data for $module is deleted. Can also be an array of IDs to delete
57 * the data of multiple user accounts.
58 * @param string $name
59 * (optional) The name of the data key. If omitted, all data associated with
60 * $module and $uid is deleted.
61 */
62 public function delete($module = NULL, $uid = NULL, $name = NULL);
63
64 }