diff --git a/src/Command/CleanAttachmentsCommand.php b/src/Command/CleanAttachmentsCommand.php index 4dca0a4b..db884992 100644 --- a/src/Command/CleanAttachmentsCommand.php +++ b/src/Command/CleanAttachmentsCommand.php @@ -2,8 +2,8 @@ namespace App\Command; -use App\Services\AttachmentHelper; -use App\Services\AttachmentReverseSearch; +use App\Services\Attachments\AttachmentManager; +use App\Services\Attachments\AttachmentReverseSearch; use App\Services\Attachments\AttachmentPathResolver; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\Table; @@ -27,7 +27,7 @@ class CleanAttachmentsCommand extends Command protected $mimeTypeGuesser; protected $pathResolver; - public function __construct(AttachmentHelper $attachmentHelper, AttachmentReverseSearch $reverseSearch, AttachmentPathResolver $pathResolver) + public function __construct(AttachmentManager $attachmentHelper, AttachmentReverseSearch $reverseSearch, AttachmentPathResolver $pathResolver) { $this->attachment_helper = $attachmentHelper; $this->pathResolver = $pathResolver; diff --git a/src/Controller/AdminPages/BaseAdminController.php b/src/Controller/AdminPages/BaseAdminController.php index 8bf37f46..2f47e6a8 100644 --- a/src/Controller/AdminPages/BaseAdminController.php +++ b/src/Controller/AdminPages/BaseAdminController.php @@ -37,7 +37,7 @@ use App\Entity\UserSystem\User; use App\Exceptions\AttachmentDownloadException; use App\Form\AdminPages\ImportType; use App\Form\AdminPages\MassCreationForm; -use App\Services\AttachmentHelper; +use App\Services\Attachments\AttachmentManager; use App\Services\Attachments\AttachmentSubmitHandler; use App\Services\EntityExporter; use App\Services\EntityImporter; @@ -69,7 +69,7 @@ abstract class BaseAdminController extends AbstractController protected $attachmentSubmitHandler; public function __construct(TranslatorInterface $translator, UserPasswordEncoderInterface $passwordEncoder, - AttachmentHelper $attachmentHelper, AttachmentSubmitHandler $attachmentSubmitHandler) + AttachmentManager $attachmentHelper, AttachmentSubmitHandler $attachmentSubmitHandler) { if ($this->entity_class === '' || $this->form_class === '' || $this->twig_template === '' || $this->route_base === '') { throw new \InvalidArgumentException('You have to override the $entity_class, $form_class, $route_base and $twig_template value in your subclasss!'); diff --git a/src/Controller/AttachmentFileController.php b/src/Controller/AttachmentFileController.php index d376b148..fd408570 100644 --- a/src/Controller/AttachmentFileController.php +++ b/src/Controller/AttachmentFileController.php @@ -36,7 +36,7 @@ use App\DataTables\AttachmentDataTable; use App\DataTables\PartsDataTable; use App\Entity\Attachments\Attachment; use App\Entity\Attachments\PartAttachment; -use App\Services\AttachmentHelper; +use App\Services\Attachments\AttachmentManager; use Omines\DataTablesBundle\DataTableFactory; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\BinaryFileResponse; @@ -52,11 +52,11 @@ class AttachmentFileController extends AbstractController * * @Route("/attachment/{id}/download", name="attachment_download") * @param Attachment $attachment - * @param AttachmentHelper $helper + * @param AttachmentManager $helper * @return BinaryFileResponse * @throws \Exception */ - public function download(Attachment $attachment, AttachmentHelper $helper) + public function download(Attachment $attachment, AttachmentManager $helper) { $this->denyAccessUnlessGranted('read', $attachment); @@ -83,11 +83,11 @@ class AttachmentFileController extends AbstractController * * @Route("/attachment/{id}/view", name="attachment_view") * @param Attachment $attachment - * @param AttachmentHelper $helper + * @param AttachmentManager $helper * @return BinaryFileResponse * @throws \Exception */ - public function view(Attachment $attachment, AttachmentHelper $helper) + public function view(Attachment $attachment, AttachmentManager $helper) { $this->denyAccessUnlessGranted('read', $attachment); diff --git a/src/Controller/PartController.php b/src/Controller/PartController.php index 80f2b729..069f4983 100644 --- a/src/Controller/PartController.php +++ b/src/Controller/PartController.php @@ -34,7 +34,7 @@ use App\Entity\Parts\Category; use App\Entity\Parts\Part; use App\Exceptions\AttachmentDownloadException; use App\Form\Part\PartBaseType; -use App\Services\AttachmentHelper; +use App\Services\Attachments\AttachmentManager; use App\Services\Attachments\AttachmentSubmitHandler; use App\Services\Attachments\PartPreviewGenerator; use App\Services\PricedetailHelper; @@ -55,10 +55,10 @@ class PartController extends AbstractController * @Route("/{id}/info", name="part_info") * @Route("/{id}", requirements={"id"="\d+"}) * @param Part $part - * @param AttachmentHelper $attachmentHelper + * @param AttachmentManager $attachmentHelper * @return \Symfony\Component\HttpFoundation\Response */ - public function show(Part $part, AttachmentHelper $attachmentHelper, PricedetailHelper $pricedetailHelper, PartPreviewGenerator $previewGenerator) + public function show(Part $part, AttachmentManager $attachmentHelper, PricedetailHelper $pricedetailHelper, PartPreviewGenerator $previewGenerator) { $this->denyAccessUnlessGranted('read', $part); @@ -83,7 +83,7 @@ class PartController extends AbstractController * @return \Symfony\Component\HttpFoundation\Response */ public function edit(Part $part, Request $request, EntityManagerInterface $em, TranslatorInterface $translator, - AttachmentHelper $attachmentHelper, AttachmentSubmitHandler $attachmentSubmitHandler) + AttachmentManager $attachmentHelper, AttachmentSubmitHandler $attachmentSubmitHandler) { $this->denyAccessUnlessGranted('edit', $part); @@ -161,7 +161,7 @@ class PartController extends AbstractController * @return \Symfony\Component\HttpFoundation\Response */ public function new(Request $request, EntityManagerInterface $em, TranslatorInterface $translator, - AttachmentHelper $attachmentHelper, AttachmentSubmitHandler $attachmentSubmitHandler) + AttachmentManager $attachmentHelper, AttachmentSubmitHandler $attachmentSubmitHandler) { $new_part = new Part(); diff --git a/src/Controller/TypeaheadController.php b/src/Controller/TypeaheadController.php index bc63aa26..ff77e02c 100644 --- a/src/Controller/TypeaheadController.php +++ b/src/Controller/TypeaheadController.php @@ -32,7 +32,7 @@ namespace App\Controller; -use App\Services\BuiltinAttachmentsFinder; +use App\Services\Attachments\BuiltinAttachmentsFinder; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; diff --git a/src/DataTables/AttachmentDataTable.php b/src/DataTables/AttachmentDataTable.php index 78a3311d..f3625691 100644 --- a/src/DataTables/AttachmentDataTable.php +++ b/src/DataTables/AttachmentDataTable.php @@ -36,7 +36,7 @@ use App\DataTables\Column\LocaleDateTimeColumn; use App\Entity\Attachments\Attachment; use App\Entity\Attachments\FootprintAttachment; use App\Entity\Parts\Part; -use App\Services\AttachmentHelper; +use App\Services\Attachments\AttachmentManager; use App\Services\Attachments\AttachmentURLGenerator; use App\Services\ElementTypeNameGenerator; use App\Services\EntityURLGenerator; @@ -58,7 +58,7 @@ class AttachmentDataTable implements DataTableTypeInterface protected $attachmentURLGenerator; public function __construct(TranslatorInterface $translator, EntityURLGenerator $entityURLGenerator, - AttachmentHelper $attachmentHelper, AttachmentURLGenerator $attachmentURLGenerator, + AttachmentManager $attachmentHelper, AttachmentURLGenerator $attachmentURLGenerator, ElementTypeNameGenerator $elementTypeNameGenerator) { $this->translator = $translator; diff --git a/src/EntityListeners/AttachmentDeleteListener.php b/src/EntityListeners/AttachmentDeleteListener.php index dffef479..cf0cfca6 100644 --- a/src/EntityListeners/AttachmentDeleteListener.php +++ b/src/EntityListeners/AttachmentDeleteListener.php @@ -33,8 +33,8 @@ namespace App\EntityListeners; use App\Entity\Attachments\Attachment; -use App\Services\AttachmentHelper; -use App\Services\AttachmentReverseSearch; +use App\Services\Attachments\AttachmentManager; +use App\Services\Attachments\AttachmentReverseSearch; use App\Services\Attachments\AttachmentPathResolver; use Doctrine\ORM\Event\LifecycleEventArgs; use Doctrine\ORM\Event\PreUpdateEventArgs; @@ -52,7 +52,7 @@ class AttachmentDeleteListener protected $attachmentHelper; protected $pathResolver; - public function __construct(AttachmentReverseSearch $attachmentReverseSearch, AttachmentHelper $attachmentHelper, AttachmentPathResolver $pathResolver) + public function __construct(AttachmentReverseSearch $attachmentReverseSearch, AttachmentManager $attachmentHelper, AttachmentPathResolver $pathResolver) { $this->attachmentReverseSearch = $attachmentReverseSearch; $this->attachmentHelper = $attachmentHelper; diff --git a/src/Form/AttachmentFormType.php b/src/Form/AttachmentFormType.php index ac30bdfb..355c47f5 100644 --- a/src/Form/AttachmentFormType.php +++ b/src/Form/AttachmentFormType.php @@ -36,7 +36,7 @@ use App\Entity\Attachments\Attachment; use App\Entity\Attachments\AttachmentType; use App\Entity\Base\StructuralDBElement; use App\Form\Type\StructuralEntityType; -use App\Services\AttachmentHelper; +use App\Services\Attachments\AttachmentManager; use App\Validator\Constraints\UrlOrBuiltin; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; @@ -60,7 +60,7 @@ class AttachmentFormType extends AbstractType protected $urlGenerator; protected $allow_attachments_download; - public function __construct(AttachmentHelper $attachmentHelper, TranslatorInterface $trans, + public function __construct(AttachmentManager $attachmentHelper, TranslatorInterface $trans, UrlGeneratorInterface $urlGenerator, bool $allow_attachments_downloads) { $this->attachment_helper = $attachmentHelper; diff --git a/src/Services/Attachments/AttachmentManager.php b/src/Services/Attachments/AttachmentManager.php index a64ba066..c6853c55 100644 --- a/src/Services/Attachments/AttachmentManager.php +++ b/src/Services/Attachments/AttachmentManager.php @@ -29,7 +29,7 @@ * */ -namespace App\Services; +namespace App\Services\Attachments; use App\Entity\Attachments\Attachment; diff --git a/src/Services/Attachments/AttachmentReverseSearch.php b/src/Services/Attachments/AttachmentReverseSearch.php index 6345f155..861d72fc 100644 --- a/src/Services/Attachments/AttachmentReverseSearch.php +++ b/src/Services/Attachments/AttachmentReverseSearch.php @@ -29,7 +29,7 @@ * */ -namespace App\Services; +namespace App\Services\Attachments; use App\Entity\Attachments\Attachment; use App\Services\Attachments\AttachmentPathResolver; diff --git a/src/Services/Attachments/AttachmentSubmitHandler.php b/src/Services/Attachments/AttachmentSubmitHandler.php index 2e6c9df0..b60e4492 100644 --- a/src/Services/Attachments/AttachmentSubmitHandler.php +++ b/src/Services/Attachments/AttachmentSubmitHandler.php @@ -47,7 +47,7 @@ use App\Entity\Attachments\StorelocationAttachment; use App\Entity\Attachments\SupplierAttachment; use App\Entity\Attachments\UserAttachment; use App\Exceptions\AttachmentDownloadException; -use App\Services\AttachmentHelper; +use App\Services\Attachments\AttachmentManager; use Doctrine\Common\Annotations\IndexedReader; use Nyholm\Psr7\Request; use Symfony\Component\Filesystem\Filesystem; diff --git a/src/Services/Attachments/AttachmentURLGenerator.php b/src/Services/Attachments/AttachmentURLGenerator.php index 08892011..f5663398 100644 --- a/src/Services/Attachments/AttachmentURLGenerator.php +++ b/src/Services/Attachments/AttachmentURLGenerator.php @@ -33,7 +33,7 @@ namespace App\Services\Attachments; use App\Entity\Attachments\Attachment; -use App\Services\AttachmentHelper; +use App\Services\Attachments\AttachmentManager; use Liip\ImagineBundle\Service\FilterService; use Symfony\Component\Asset\Package; use Symfony\Component\Asset\Packages; @@ -49,7 +49,7 @@ class AttachmentURLGenerator protected $filterService; public function __construct(Packages $assets, AttachmentPathResolver $pathResolver, - UrlGeneratorInterface $urlGenerator, AttachmentHelper $attachmentHelper, + UrlGeneratorInterface $urlGenerator, AttachmentManager $attachmentHelper, FilterService $filterService) { $this->assets = $assets; diff --git a/src/Services/Attachments/BuiltinAttachmentsFinder.php b/src/Services/Attachments/BuiltinAttachmentsFinder.php index 9bd440c0..4845e9af 100644 --- a/src/Services/Attachments/BuiltinAttachmentsFinder.php +++ b/src/Services/Attachments/BuiltinAttachmentsFinder.php @@ -29,7 +29,7 @@ * */ -namespace App\Services; +namespace App\Services\Attachments; use App\Entity\Attachments\Attachment; use App\Services\Attachments\AttachmentPathResolver; diff --git a/src/Services/Attachments/PartPreviewGenerator.php b/src/Services/Attachments/PartPreviewGenerator.php index 2b79d92e..df7632e8 100644 --- a/src/Services/Attachments/PartPreviewGenerator.php +++ b/src/Services/Attachments/PartPreviewGenerator.php @@ -34,7 +34,7 @@ namespace App\Services\Attachments; use App\Entity\Attachments\Attachment; use App\Entity\Parts\Part; -use App\Services\AttachmentHelper; +use App\Services\Attachments\AttachmentManager; /** * @package App\Services\Attachments @@ -43,7 +43,7 @@ class PartPreviewGenerator { protected $attachmentHelper; - public function __construct(AttachmentHelper $attachmentHelper) + public function __construct(AttachmentManager $attachmentHelper) { $this->attachmentHelper = $attachmentHelper; } diff --git a/tests/Services/Attachments/AttachmentURLGeneratorTest.php b/tests/Services/Attachments/AttachmentURLGeneratorTest.php index eee43db9..3db26196 100644 --- a/tests/Services/Attachments/AttachmentURLGeneratorTest.php +++ b/tests/Services/Attachments/AttachmentURLGeneratorTest.php @@ -33,7 +33,7 @@ namespace App\Tests\Services\Attachments; use App\Services\Attachments\AttachmentURLGenerator; -use App\Services\BuiltinAttachmentsFinder; +use App\Services\Attachments\BuiltinAttachmentsFinder; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class AttachmentURLGeneratorTest extends WebTestCase diff --git a/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php b/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php index ce26ea60..6a79add2 100644 --- a/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php +++ b/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php @@ -31,7 +31,7 @@ namespace App\Tests\Services\Attachments; -use App\Services\BuiltinAttachmentsFinder; +use App\Services\Attachments\BuiltinAttachmentsFinder; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class BuiltinAttachmentsFinderTest extends WebTestCase