Delete positions with tracks in deleteAll
This commit is contained in:
parent
65a5c95f67
commit
4ddbbb9807
@ -155,14 +155,19 @@
|
|||||||
public static function deleteAll($userId) {
|
public static function deleteAll($userId) {
|
||||||
$ret = false;
|
$ret = false;
|
||||||
if (!empty($userId)) {
|
if (!empty($userId)) {
|
||||||
$query = "DELETE FROM `" . self::db()->table('tracks') . "` WHERE user_id = ?";
|
// remove all positions
|
||||||
$stmt = self::db()->prepare($query);
|
if (uPosition::deleteAll($userId) === true) {
|
||||||
$stmt->bind_param('i', $userId);
|
// remove all tracks
|
||||||
$stmt->execute();
|
$query = "DELETE FROM `" . self::db()->table('tracks') . "` WHERE user_id = ?";
|
||||||
if (!self::db()->error && !$stmt->errno) {
|
$stmt = self::db()->prepare($query);
|
||||||
$ret = true;
|
$stmt->bind_param('i', $userId);
|
||||||
|
$stmt->execute();
|
||||||
|
if (!self::db()->error && !$stmt->errno) {
|
||||||
|
$ret = true;
|
||||||
|
}
|
||||||
|
$stmt->close();
|
||||||
}
|
}
|
||||||
$stmt->close();
|
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
@ -100,11 +100,7 @@
|
|||||||
public function delete() {
|
public function delete() {
|
||||||
$ret = false;
|
$ret = false;
|
||||||
if ($this->isValid) {
|
if ($this->isValid) {
|
||||||
// remove positions
|
// remove tracks and positions
|
||||||
if (uPosition::deleteAll($this->id) === false) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// remove tracks
|
|
||||||
if (uTrack::deleteAll($this->id) === false) {
|
if (uTrack::deleteAll($this->id) === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user