Commit 619800c0 authored by Andreas Heimann's avatar Andreas Heimann

added support for filereference urls

parent 7e63d145
......@@ -27,12 +27,17 @@ class SongController extends AbstractController
/**
* @Route("/song/{songId}", name="song.detail")
*/
public function songDetail(Request $request, int $songId)
public function songDetail(Request $request, $songId)
{
$em = $this->getDoctrine()->getManager();
$data = [];
if(strpos($songId, "spinshare_") !== false) {
$resultSong = $em->getRepository(Song::class)->findOneBy(array('fileReference' => $songId));
} else {
$resultSong = $em->getRepository(Song::class)->findOneBy(array('id' => $songId));
}
if(!$resultSong) throw new NotFoundHttpException();
$resultSong->setViews($resultSong->getViews() + 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment