setId((int)$id); } function setId($id) { // Set id and wipe data $this->_id = $id; $this->_data = null; } function &getAlbumSongs() { // Load the data if (empty( $this->_files )) { $query = ' SELECT * '. ' FROM #__muscol_songs '. ' WHERE album_id = '.$this->_id ; $this->_db->setQuery( $query ); $this->_files = $this->_db->loadObjectList(); } return $this->_files; } function &getData() { // Load the data if (empty( $this->_data )) { $query = ' SELECT * '. ' FROM #__muscol_songs '. ' WHERE id = '.$this->_id ; $this->_db->setQuery( $query ); $this->_data = $this->_db->loadObject(); } $query = ' UPDATE #__muscol_songs SET downloaded = '. ( $this->_data->downloaded + 1 ) ; $this->_db->setQuery($query); $this->_db->query(); return $this->_data; } }