Allow to add/delete attachments via part edit page.

This commit is contained in:
Jan Böhmer 2019-08-26 23:30:35 +02:00
parent fcfab982a8
commit 3a11933a89
12 changed files with 370 additions and 50 deletions

View file

@ -31,12 +31,15 @@
namespace App\Form\Part;
use App\Entity\Attachments\PartAttachment;
use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\Storelocation;
use App\Form\AttachmentFormType;
use App\Form\AttachmentType;
use App\Form\Type\SIUnitType;
use App\Form\Type\StructuralEntityType;
use Doctrine\DBAL\Types\FloatType;
@ -130,6 +133,17 @@ class PartBaseType extends AbstractType
'by_reference' => false
]);
//Attachment section
$builder->add('attachments', CollectionType::class, [
'entry_type' => AttachmentFormType::class,
'allow_add' => true, 'allow_delete' => true,
'label' => false,
'entry_options' => [
'data_class' => PartAttachment::class
],
'by_reference' => false
]);
$builder
//Buttons
->add('save', SubmitType::class, ['label' => 'part.edit.save'])