Test details album

This commit is contained in:
Vincent
2024-06-04 22:46:59 +02:00
parent d2b77e594d
commit a0519979f4
3 changed files with 59 additions and 0 deletions

View File

@@ -102,6 +102,29 @@ class Model_music extends CI_Model {
return $result->result();
}
public function getAlbumDetails($albumId) {
// Get album info
$this->db->select('album.name as albumName, album.id, year, artist.name as artistName, genre.name as genreName, jpeg');
$this->db->from('album');
$this->db->join('artist', 'album.artistid = artist.id');
$this->db->join('genre', 'genre.id = album.genreid');
$this->db->join('cover', 'cover.id = album.coverid');
$this->db->where('album.id', $albumId);
$albumQuery = $this->db->get();
$albumDetails = $albumQuery->row();
// Get album songs
$this->db->select('song.name as trackName, track.id as trackId');
$this->db->from('track');
$this->db->join('song', 'track.songId = song.id');
$this->db->where('track.albumId', $albumId);
$songsQuery = $this->db->get();
$songs = $songsQuery->result();
return array('album' => $albumDetails, 'songs' => $songs);
}
// Suppression de la deuxième méthode researchtype
public function research(){