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 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()); }