Moved attachment related services into their own namespaces

This commit is contained in:
Jan Böhmer 2019-10-19 23:29:51 +02:00
parent f5f581293a
commit c955a3a221
16 changed files with 33 additions and 33 deletions

View file

@ -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;

View file

@ -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!');

View file

@ -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);

View file

@ -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();

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -29,7 +29,7 @@
*
*/
namespace App\Services;
namespace App\Services\Attachments;
use App\Entity\Attachments\Attachment;

View file

@ -29,7 +29,7 @@
*
*/
namespace App\Services;
namespace App\Services\Attachments;
use App\Entity\Attachments\Attachment;
use App\Services\Attachments\AttachmentPathResolver;

View file

@ -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;

View file

@ -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;

View file

@ -29,7 +29,7 @@
*
*/
namespace App\Services;
namespace App\Services\Attachments;
use App\Entity\Attachments\Attachment;
use App\Services\Attachments\AttachmentPathResolver;

View file

@ -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;
}

View file

@ -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

View file

@ -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