Delete positions with tracks in deleteAll

This commit is contained in:
Bartek Fabiszewski 2017-08-17 17:18:41 +02:00
parent 65a5c95f67
commit 4ddbbb9807
2 changed files with 13 additions and 12 deletions

View File

@ -155,6 +155,9 @@
public static function deleteAll($userId) {
$ret = false;
if (!empty($userId)) {
// remove all positions
if (uPosition::deleteAll($userId) === true) {
// remove all tracks
$query = "DELETE FROM `" . self::db()->table('tracks') . "` WHERE user_id = ?";
$stmt = self::db()->prepare($query);
$stmt->bind_param('i', $userId);
@ -164,6 +167,8 @@
}
$stmt->close();
}
}
return $ret;
}

View File

@ -100,11 +100,7 @@
public function delete() {
$ret = false;
if ($this->isValid) {
// remove positions
if (uPosition::deleteAll($this->id) === false) {
return false;
}
// remove tracks
// remove tracks and positions
if (uTrack::deleteAll($this->id) === false) {
return false;
}