Merged com.woltlab.wcf.user into WCF
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / data / user / follow / UserFollow.class.php
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
10 * @copyright 2001-2013 WoltLab GmbH
11 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
12 * @package com.woltlab.wcf.user
13 * @subpackage data.user.follow
14 * @category Community Framework
15 */
16 class UserFollow extends DatabaseObject {
17 /**
18 * @see wcf\data\DatabaseObject::$databaseTableName
19 */
20 protected static $databaseTableName = 'user_follow';
21
22 /**
23 * @see wcf\data\DatabaseObject::$databaseTableIndexName
24 */
25 protected static $databaseTableIndexName = 'followID';
26
27 /**
28 * Retrieves a follower.
29 *
30 * @param integer $userID
31 * @param integer $followUserID
32 * @return wcf\data\user\follow\UserFollow
33 */
34 public static function getFollow($userID, $followUserID) {
35 $sql = "SELECT followID
36 FROM wcf".WCF_N."_user_follow
37 WHERE userID = ?
38 AND followUserID = ?";
39 $statement = WCF::getDB()->prepareStatement($sql);
40 $statement->execute(array(
41 $userID,
42 $followUserID
43 ));
44
45 $row = $statement->fetchArray();
46 if (!$row) $row = array();
47
48 return new UserFollow(null, $row);
49 }
50 }