public function testIndex() { // $client = static::createClient(); // // $crawler = $client->request('GET', '/app/example'); // // $this->assertEquals(200, $client->getResponse()->getStatusCode()); // $this->assertTrue($crawler->filter('html:contains("Homepage")')->count() > 0); echo "HI"; $songObject; echo "asdfff"; $newSong = new song(); $newSong->setUserid(0); echo "asdf"; $newSong->setSongtitle("SDFLKSDF"); $em = $this->getDoctrine()->getManager(); $em->persist($newSong); $em->flush(); }
/** * @Route("/init", name="init") */ public function initAction() { $em = $this->getDoctrine()->getManager(); $repository = $this->getDoctrine()->getRepository('AppBundle:song'); $existingSongs = $repository->findBySongtitle("Hide and Seek (demo)"); if ($existingSongs) { foreach ($existingSongs as $song) { $em->remove($song); } } $existingSongs = $repository->findBySongtitle("Hallelujah (demo)"); if ($existingSongs) { foreach ($existingSongs as $song) { $em->remove($song); } } $em->flush(); $newSong = new song(); $newSong->setUserid(0); $newSong->setSlug("HideAndSeek"); $newSong->setSongtitle("Hide and Seek (demo)"); $em->persist($newSong); $em->flush(); $songid = $newSong->getId(); // $newTrack = new track(); // $newTrack->setSongid($songid ); // $newTrack->setUrl("/example/HaS/01-Piano.mp3"); // $newTrack->setTracktitle("All Piano"); // $em->persist($newTrack); $newTrack2 = new track(); $newTrack2->setSongid($songid); $newTrack2->setUrl("/example/HaS/02-Soprano.mp3"); $newTrack2->setTracktitle("Soprano"); $em->persist($newTrack2); $newTrack2 = new track(); $newTrack2->setSongid($songid); $newTrack2->setUrl("/example/HaS/03-Alto.mp3"); $newTrack2->setTracktitle("Alto"); $em->persist($newTrack2); $newTrack2 = new track(); $newTrack2->setSongid($songid); $newTrack2->setUrl("/example/HaS/04-Tenor.mp3"); $newTrack2->setTracktitle("Tenor"); $em->persist($newTrack2); $newTrack2 = new track(); $newTrack2->setSongid($songid); $newTrack2->setUrl("/example/HaS/05-Bass.mp3"); $newTrack2->setTracktitle("Bass"); $em->persist($newTrack2); $newSong2 = new song(); $newSong2->setUserid(0); $newSong2->setSlug("hallelujah"); $newSong2->setSongtitle("Hallelujah (demo)"); $em->persist($newSong2); $em->flush(); $songid = $newSong2->getId(); $newTrack2 = new track(); $newTrack2->setSongid($songid); $newTrack2->setUrl("/example/beets/sop.mp3"); $newTrack2->setTracktitle("Soprano"); $em->persist($newTrack2); $newTrack2 = new track(); $newTrack2->setSongid($songid); $newTrack2->setUrl("/example/beets/alto.mp3"); $newTrack2->setTracktitle("Alto"); $em->persist($newTrack2); $newTrack2 = new track(); $newTrack2->setSongid($songid); $newTrack2->setUrl("/example/beets/tenor.mp3"); $newTrack2->setTracktitle("Tenor"); $em->persist($newTrack2); $newTrack2 = new track(); $newTrack2->setSongid($songid); $newTrack2->setUrl("/example/beets/bass.mp3"); $newTrack2->setTracktitle("Bass"); $em->persist($newTrack2); $em->flush(); return new Response("ok"); }