Commit | Line | Data |
---|---|---|
320f4a6d | 1 | <?php |
a9229942 | 2 | |
320f4a6d | 3 | namespace wcf\data\user\follow; |
a9229942 | 4 | |
320f4a6d MW |
5 | use wcf\data\DatabaseObject; |
6 | use wcf\system\WCF; | |
7 | ||
8 | /** | |
9 | * Represents a user's follower. | |
e9335ed9 | 10 | * |
a9229942 TD |
11 | * @author Alexander Ebert |
12 | * @copyright 2001-2019 WoltLab GmbH | |
13 | * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> | |
a9229942 TD |
14 | * |
15 | * @property-read int $followID unique id of the following relation | |
16 | * @property-read int $userID id of the following user | |
17 | * @property-read int $followUserID id of the followed user | |
18 | * @property-read int $time time at which following relation has been established | |
320f4a6d | 19 | */ |
a9229942 TD |
20 | class UserFollow extends DatabaseObject |
21 | { | |
22 | /** | |
23 | * Retrieves a follower. | |
24 | * | |
25 | * @param int $userID | |
26 | * @param int $followUserID | |
27 | * @return UserFollow | |
28 | */ | |
29 | public static function getFollow($userID, $followUserID) | |
30 | { | |
31 | $sql = "SELECT followID | |
32 | FROM wcf" . WCF_N . "_user_follow | |
33 | WHERE userID = ? | |
34 | AND followUserID = ?"; | |
35 | $statement = WCF::getDB()->prepareStatement($sql); | |
36 | $statement->execute([ | |
37 | $userID, | |
38 | $followUserID, | |
39 | ]); | |
40 | ||
41 | $row = $statement->fetchArray(); | |
42 | if (!$row) { | |
43 | $row = []; | |
44 | } | |
45 | ||
46 | return new self(null, $row); | |
47 | } | |
320f4a6d | 48 | } |