Fixed issue with removing the bom entries caused by the multiple collapse rows

This commit is contained in:
Jan Böhmer 2022-12-28 23:06:52 +01:00
parent a3ee51e76b
commit 39ed00c7c0
6 changed files with 83 additions and 40 deletions

View file

@ -21,6 +21,7 @@
namespace App\Form\AdminPages;
use App\Entity\Base\AbstractNamedDBElement;
use App\Form\ProjectSystem\ProjectBOMEntryCollectionType;
use App\Form\ProjectSystem\ProjectBOMEntryType;
use App\Form\Type\RichTextEditorType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
@ -41,16 +42,6 @@ class ProjectAdminForm extends BaseEntityAdminForm
],
]);
$builder->add('bom_entries', CollectionType::class, [
'entry_type' => ProjectBOMEntryType::class,
'entry_options' => [
'label' => false,
],
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
'reindex_enable' => true,
'label' => false,
]);
$builder->add('bom_entries', ProjectBOMEntryCollectionType::class);
}
}

View file

@ -0,0 +1,35 @@
<?php
namespace App\Form\ProjectSystem;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\OptionsResolver\OptionsResolver;
class ProjectBOMEntryCollectionType extends AbstractType
{
public function getParent()
{
return CollectionType::class;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'entry_type' => ProjectBOMEntryType::class,
'entry_options' => [
'label' => false,
],
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
'reindex_enable' => true,
'label' => false,
]);
}
public function getBlockPrefix()
{
return 'project_bom_entry_collection';
}
}