public function testPublish()
 {
     $package = new BookPackage($this->createFixtureBook());
     $package->setTmpFolderPath($this->bookTmpFolderPath);
     $package->setTemplateFolderPath($this->bookTemplateFolderPath);
     $package->setBooksFolderPath($this->bookPrivateBooksFolderPath);
     $package->updateBookSlug();
     $package->createBootstrapFiles();
     $publisher = new BookPublisher($package);
     $publisher->setPublishBooksFolderPath($this->bookPublishBooksFolderPath);
     $publisher->publish();
 }
 /**
  * @Route("/publish/{slug}", name="book-publish")
  */
 public function publishAction($slug)
 {
     $em = $this->getDoctrine()->getManager();
     $book = $em->getRepository('eTextBookLoungeBundle:Book')->findOneBy(array('slug' => $slug));
     if (!$book) {
         throw $this->createNotFoundException('No product found for id ' . $slug);
     }
     $package = new BookPackage($book);
     $package->setBooksFolderPath($this->container->getParameter('books_dir'));
     $package->setTemplateFolderPath($this->container->getParameter('book_template_dir'));
     $package->setTmpFolderPath($this->container->getParameter('book_tmp_dir'));
     $package->updateBookSlug();
     $publisher = new BookPublisher($package);
     $publisher->setPublishBooksFolderPath($this->container->getParameter('public_dir'));
     $publisher->publish();
     $publisher->publishPdf($this->get('knp_snappy.pdf'));
     $em->persist($package->getBook());
     $em->flush();
     return $this->redirect($this->generateUrl('books'));
 }