Exemple #1
0
 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();
 }
Exemple #2
0
 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);
 }
Exemple #3
0
 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);
 }
Exemple #4
0
 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();
 }
Exemple #5
0
 public function testBridgeCount()
 {
     $join = new Sabel_Db_Join("StudentCourse");
     $join->setCondition("Student.id", 3);
     $this->assertEquals(3, $join->add("Student")->add("Course")->getCount());
 }