public function setUp()
 {
     $this->setApplicationConfig(include __DIR__ . '/application.config.php');
     parent::setUp();
     $serviceManager = $this->getApplication()->getServiceManager();
     $this->objectManager = $serviceManager->get('doctrine.entitymanager.orm_default');
     $objectManager = $this->objectManager;
     $tool = new SchemaTool($objectManager);
     $res = $tool->createSchema($objectManager->getMetadataFactory()->getAllMetadata());
     $artist1 = new Entity\Artist();
     $artist1->setName('ArtistOne');
     $artist1->setCreatedAt(new DateTime('2011-12-18 13:17:17'));
     $objectManager->persist($artist1);
     $artist2 = new Entity\Artist();
     $artist2->setName('ArtistTwo');
     $artist2->setCreatedAt(new DateTime('2014-12-18 13:17:17'));
     $objectManager->persist($artist2);
     $artist3 = new Entity\Artist();
     $artist3->setName('ArtistThree');
     $artist3->setCreatedAt(new DateTime('2012-12-18 13:17:17'));
     $objectManager->persist($artist3);
     $artist4 = new Entity\Artist();
     $artist4->setName('ArtistFour');
     $artist4->setCreatedAt(new DateTime('2013-12-18 13:17:17'));
     $objectManager->persist($artist4);
     $artist5 = new Entity\Artist();
     $artist5->setName('ArtistFive');
     $objectManager->persist($artist5);
     $album1 = new Entity\Album();
     $album1->setName('AlbumOne');
     $album1->setCreatedAt(new DateTime('2013-12-18 13:17:17'));
     $album1->setArtist($artist1);
     $objectManager->persist($album1);
     $album2 = new Entity\Album();
     $album2->setName('AlbumTwo');
     $album2->setCreatedAt(new DateTime('2013-12-18 13:17:17'));
     $album2->setArtist($artist1);
     $objectManager->persist($album2);
     $album3 = new Entity\Album();
     $album3->setName('AlbumThree');
     $album3->setCreatedAt(new DateTime('2013-12-18 13:17:17'));
     $album3->setArtist($artist1);
     $objectManager->persist($album3);
     $album4 = new Entity\Album();
     $album4->setName('AlbumFour');
     $album4->setCreatedAt(new DateTime('2013-12-18 13:17:17'));
     $album4->setArtist($artist2);
     $objectManager->persist($album4);
     $album5 = new Entity\Album();
     $album5->setName('AlbumFive');
     $album5->setCreatedAt(new DateTime('2013-12-18 13:17:17'));
     $album5->setArtist($artist2);
     $objectManager->persist($album5);
     $album6 = new Entity\Album();
     $album6->setName('AlbumSix');
     $album6->setCreatedAt(new DateTime('2013-12-18 13:17:17'));
     $objectManager->persist($album6);
     $objectManager->flush();
 }
 public function load(ObjectManager $objectManager)
 {
     $artist = new Entity\Artist();
     $artist->setName('Soft Cell');
     $objectManager->persist($artist);
     $album = new Entity\Album();
     $album->setName('Non-Stop Erotic Cabaret');
     $album->setArtist($artist);
     $artist->addAlbum($album);
     $objectManager->persist($album);
     $song = new Entity\Song();
     $song->setName('Tainted Love');
     $song->setAlbum($album);
     $album->addSong($song);
     $objectManager->persist($song);
     $objectManager->flush();
 }