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