also use raw for wishes
This commit is contained in:
12
lib/User.php
12
lib/User.php
@@ -225,14 +225,18 @@ class User extends DbMapping
|
|||||||
public function getWishes($limit = 50)
|
public function getWishes($limit = 50)
|
||||||
{
|
{
|
||||||
if (!$this->wishes) {
|
if (!$this->wishes) {
|
||||||
$strSQL = "SELECT TOP " . $limit . AudioBook::$idColumn . " FROM " . User::$wishTableName . " WHERE " . User::$idColumn . " = $this->id ORDER BY CreationDate desc";
|
$sql = "SELECT TOP $limit
|
||||||
|
NoticeID
|
||||||
|
FROM ".User::$wishTableName."
|
||||||
|
WHERE ".User::$idColumn . " = $this->id
|
||||||
|
ORDER BY CreationDate desc";
|
||||||
|
|
||||||
$result = Connection::execute($strSQL);
|
$result = Connection::execute($sql);
|
||||||
$ids = array();
|
$ids = array();
|
||||||
while ($row = $result->next()) {
|
while ($row = $result->next()) {
|
||||||
$ids[] = $row['NoticeID'];
|
$ids[] = $row['NoticeID'];
|
||||||
}
|
}
|
||||||
$this->wishes = AudioBook::find($ids);
|
$this->wishes = AudioBook::findBy('NoticeID', $ids, true);
|
||||||
}
|
}
|
||||||
return $this->wishes;
|
return $this->wishes;
|
||||||
}
|
}
|
||||||
@@ -246,7 +250,7 @@ class User extends DbMapping
|
|||||||
$noticeId = str_replace("'", "''", $noticeId);
|
$noticeId = str_replace("'", "''", $noticeId);
|
||||||
$table = User::$wishTableName;
|
$table = User::$wishTableName;
|
||||||
$strSQL = "DELETE FROM $table";
|
$strSQL = "DELETE FROM $table";
|
||||||
$strSQL .= " WHERE " . AudioBook::$idColumn . " = $noticeId AND " . User::$idColumn . " = $this->id;";
|
$strSQL .= " WHERE NoticeID = $noticeId AND " . User::$idColumn . " = $this->id;";
|
||||||
Connection::execute($strSQL, true);
|
Connection::execute($strSQL, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user