public static function getRequestsByUserId($userId) { $join = new Sabel_Db_Join("Request"); $join->setCondition("Request.request_id", $userId); $join->setOrderBy("Request.created_at", "desc"); return $join->add("User")->select(); }
public function getFollowers($userId, $params, $limit = null) { if ($limit === null) { $limit = self::DEFAULT_ITEM_LIMIT; } $join = new Sabel_Db_Join("Follower"); $paginator = new Paginator($join->add("Users", "", array("id" => "uid", "fkey" => "user_id"))); $paginator->setCondition("Follower.follow_id", $userId); $paginator->setDefaultOrder("Follower.created_at", "desc"); return $paginator->build($limit, $params); }
public function getPublicStatuses($params, $limit = null) { if ($limit === null) { $limit = self::DEFAULT_ITEM_LIMIT; } $join = new Sabel_Db_Join("Status"); $paginator = new Paginator($join->add("User")); // $paginator->setCondition("User.private_flag", false); $paginator->setDefaultOrder("Status.created_at", "desc"); return $paginator->build($limit, $params); }
public static function getFriends($userId, $limit) { $join = new Sabel_Db_Join(new self()); $join->add("Users", "", array("id" => "uid", "fkey" => "follow_id")); $join->setCondition("Follower.user_id", $userId); $join->setOrderBy("Follower.created_at"); $join->setLimit($limit); return $join->select(); }
public function testBridgeCount() { $join = new Sabel_Db_Join("StudentCourse"); $join->setCondition("Student.id", 3); $this->assertEquals(3, $join->add("Student")->add("Course")->getCount()); }