mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Use correct Attachment class for Storelocation Controller.
This fixes issue #81.
This commit is contained in:
parent
09cb74d8bd
commit
1caaad908b
3 changed files with 12 additions and 6 deletions
|
@ -43,12 +43,14 @@ declare(strict_types=1);
|
|||
namespace App\Controller\AdminPages;
|
||||
|
||||
use App\DataTables\LogDataTable;
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\Base\PartsContainingRepositoryInterface;
|
||||
use App\Entity\LabelSystem\LabelProfile;
|
||||
use App\Entity\Parameters\AbstractParameter;
|
||||
use App\Entity\UserSystem\User;
|
||||
use App\Exceptions\AttachmentDownloadException;
|
||||
use App\Form\AdminPages\ImportType;
|
||||
|
@ -114,12 +116,12 @@ abstract class BaseAdminController extends AbstractController
|
|||
throw new InvalidArgumentException('You have to override the $entity_class, $form_class, $route_base and $twig_template value in your subclasss!');
|
||||
}
|
||||
|
||||
if ('' === $this->attachment_class) {
|
||||
throw new InvalidArgumentException('You have to override the $attachment_class value in your subclass!');
|
||||
if ('' === $this->attachment_class || !is_a($this->attachment_class, Attachment::class, true)) {
|
||||
throw new InvalidArgumentException('You have to override the $attachment_class value with a valid Attachment class in your subclass!');
|
||||
}
|
||||
|
||||
if ('' === $this->parameter_class) {
|
||||
throw new InvalidArgumentException('You have to override the $parameter_class value in your subclass!');
|
||||
if ('' === $this->parameter_class || !is_a($this->parameter_class, AbstractParameter::class, true)) {
|
||||
throw new InvalidArgumentException('You have to override the $parameter_class value with a valid Parameter class in your subclass!');
|
||||
}
|
||||
|
||||
$this->translator = $translator;
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace App\Controller\AdminPages;
|
|||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Attachments\LabelAttachment;
|
||||
use App\Entity\LabelSystem\LabelProfile;
|
||||
use App\Entity\Parameters\AbstractParameter;
|
||||
use App\Form\AdminPages\LabelProfileAdminForm;
|
||||
use App\Services\EntityExporter;
|
||||
use App\Services\EntityImporter;
|
||||
|
@ -54,6 +55,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
|
|||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Http\Authenticator\AbstractPreAuthenticatedAuthenticator;
|
||||
|
||||
/**
|
||||
* @Route("/label_profile")
|
||||
|
@ -65,7 +67,8 @@ class LabelProfileController extends BaseAdminController
|
|||
protected $form_class = LabelProfileAdminForm::class;
|
||||
protected $route_base = 'label_profile';
|
||||
protected $attachment_class = LabelAttachment::class;
|
||||
protected $parameter_class = 'not_used';
|
||||
//Just a placeholder
|
||||
protected $parameter_class = AbstractParameter::class;
|
||||
|
||||
/**
|
||||
* @Route("/{id}", name="label_profile_delete", methods={"DELETE"})
|
||||
|
|
|
@ -42,6 +42,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Controller\AdminPages;
|
||||
|
||||
use App\Entity\Attachments\StorelocationAttachment;
|
||||
use App\Entity\Parameters\StorelocationParameter;
|
||||
use App\Entity\Parts\Storelocation;
|
||||
use App\Form\AdminPages\StorelocationAdminForm;
|
||||
|
@ -63,7 +64,7 @@ class StorelocationController extends BaseAdminController
|
|||
protected $twig_template = 'AdminPages/StorelocationAdmin.html.twig';
|
||||
protected $form_class = StorelocationAdminForm::class;
|
||||
protected $route_base = 'store_location';
|
||||
protected $attachment_class = StorelocationAdminForm::class;
|
||||
protected $attachment_class = StorelocationAttachment::class;
|
||||
protected $parameter_class = StorelocationParameter::class;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue