From 001cc7168aa1a7e9b8290b9c29566c586ac8b511 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 3 Nov 2016 18:01:25 +0100 Subject: [PATCH] Cleanup --- .../ApiBundle/Controller/TagRestController.php | 16 ---------------- .../Controller/WallabagRestController.php | 3 +-- .../CoreBundle/Controller/ConfigController.php | 2 -- .../Event/Subscriber/TablePrefixSubscriber.php | 2 +- .../CoreBundle/Helper/DownloadImages.php | 6 +++--- .../ImportBundle/Command/ImportCommand.php | 5 ----- .../ImportBundle/Consumer/AbstractConsumer.php | 1 + 7 files changed, 6 insertions(+), 29 deletions(-) diff --git a/src/Wallabag/ApiBundle/Controller/TagRestController.php b/src/Wallabag/ApiBundle/Controller/TagRestController.php index 4e7ddc66..bc6d4e64 100644 --- a/src/Wallabag/ApiBundle/Controller/TagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/TagRestController.php @@ -131,22 +131,6 @@ class TagRestController extends WallabagRestController return (new JsonResponse())->setJson($json); } - /** - * Retrieve version number. - * - * @ApiDoc() - * - * @return JsonResponse - */ - public function getVersionAction() - { - $version = $this->container->getParameter('wallabag_core.version'); - - $json = $this->get('serializer')->serialize($version, 'json'); - - return (new JsonResponse())->setJson($json); - } - /** * Remove orphan tag in case no entries are associated to it. * diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index 1ff593f5..b1e08ca4 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php @@ -3,10 +3,9 @@ namespace Wallabag\ApiBundle\Controller; use FOS\RestBundle\Controller\FOSRestController; -use Symfony\Component\Security\Core\Exception\AccessDeniedException; -use Wallabag\CoreBundle\Entity\Entry; use Nelmio\ApiDocBundle\Annotation\ApiDoc; use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\Security\Core\Exception\AccessDeniedException; class WallabagRestController extends FOSRestController { diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index d40efcd7..fe817711 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -234,8 +234,6 @@ class ConfigController extends Controller */ public function resetAction($type) { - $em = $this->getDoctrine()->getManager(); - switch ($type) { case 'annotations': $this->getDoctrine() diff --git a/src/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriber.php b/src/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriber.php index 9013328f..711c3bf8 100644 --- a/src/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriber.php +++ b/src/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriber.php @@ -39,7 +39,7 @@ class TablePrefixSubscriber implements EventSubscriber return; } - $classMetadata->setTableName($this->prefix.$classMetadata->getTableName()); + $classMetadata->setPrimaryTable(['name' => $this->prefix.$classMetadata->getTableName()]); foreach ($classMetadata->getAssociationMappings() as $fieldName => $mapping) { if ($mapping['type'] === ClassMetadataInfo::MANY_TO_MANY && isset($classMetadata->associationMappings[$fieldName]['joinTable']['name'])) { diff --git a/src/Wallabag/CoreBundle/Helper/DownloadImages.php b/src/Wallabag/CoreBundle/Helper/DownloadImages.php index c5298236..264bc6a3 100644 --- a/src/Wallabag/CoreBundle/Helper/DownloadImages.php +++ b/src/Wallabag/CoreBundle/Helper/DownloadImages.php @@ -135,16 +135,16 @@ class DownloadImages switch ($ext) { case 'gif': - $result = imagegif($im, $localPath); + imagegif($im, $localPath); $this->logger->debug('DownloadImages: Re-creating gif'); break; case 'jpeg': case 'jpg': - $result = imagejpeg($im, $localPath, self::REGENERATE_PICTURES_QUALITY); + imagejpeg($im, $localPath, self::REGENERATE_PICTURES_QUALITY); $this->logger->debug('DownloadImages: Re-creating jpg'); break; case 'png': - $result = imagepng($im, $localPath, ceil(self::REGENERATE_PICTURES_QUALITY / 100 * 9)); + imagepng($im, $localPath, ceil(self::REGENERATE_PICTURES_QUALITY / 100 * 9)); $this->logger->debug('DownloadImages: Re-creating png'); } diff --git a/src/Wallabag/ImportBundle/Command/ImportCommand.php b/src/Wallabag/ImportBundle/Command/ImportCommand.php index 13f3dcb9..e423ffae 100644 --- a/src/Wallabag/ImportBundle/Command/ImportCommand.php +++ b/src/Wallabag/ImportBundle/Command/ImportCommand.php @@ -56,13 +56,8 @@ class ImportCommand extends ContainerAwareCommand case 'instapaper': $import = $this->getContainer()->get('wallabag_import.instapaper.import'); break; - case 'instapaper': - $wallabag = $this->getContainer()->get('wallabag_import.instapaper.import'); - break; - case 'v1': default: $import = $this->getContainer()->get('wallabag_import.wallabag_v1.import'); - break; } $import->setMarkAsRead($input->getOption('markAsRead')); diff --git a/src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php b/src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php index aa7ff914..fc175f67 100644 --- a/src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php +++ b/src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php @@ -17,6 +17,7 @@ abstract class AbstractConsumer protected $em; protected $userRepository; protected $import; + protected $eventDispatcher; protected $logger; public function __construct(EntityManager $em, UserRepository $userRepository, AbstractImport $import, EventDispatcherInterface $eventDispatcher, LoggerInterface $logger = null) -- 2.41.0